使用UIImage全屏时需要哪些类型/尺寸的图像?

时间:2022-02-18 15:17:25

I'm targeting iOS8 to release an application. So it'll be available on 4S, 5's, 6, 6+, and iPad 2+.

我的目标是iOS8发布一个应用程序。它可以在4S, 5, 6+和iPad 2+上使用。

I have a ViewController where, I present a UIImageView that is the entire size of my UIViewController's View.

我有一个视图控制器,我展示了一个UIImageView那是我的UIViewController的整个尺寸。

My question is... what sizes do I need the image in. Am I going to need it in a special size for each device? Or does the 4s/5/6 all use the same ratios for example, while the 6+ has its own unique ratio? Or do I just use 1 image size and let it auto scale it (or will that stretch/skew the image)?

我的问题是……我需要图像的大小。每个设备都需要一个特殊的尺寸吗?或者是4s/5/6都使用相同的比率,而6+有自己独特的比率?或者我只是使用一个图像大小并让它自动缩放(或者这会拉伸/倾斜图像)?

Also, what's the minimal size the image should be? If it's smaller than the native size of the iPhone 6+ for example, won't the quality of the image deteriorate?

此外,图像的最小尺寸应该是多少?如果它小于iPhone 6+的本机尺寸,图像的质量不会恶化吗?

3 个解决方案

#1


1  

In iOS8, you can use different size classes for different screens

在iOS8中,可以为不同的屏幕使用不同大小的类

use this post to begin.

使用这篇文章开始。

Also refer this for more info about using different graphics for varying resolution.

关于使用不同的图形以获得不同分辨率的更多信息,请参考本文。

#2


0  

The image in Imageview in 4s/5/6 devices render at @2x while that in 6+ it renders at @3x.So take an image and name it as Demo@2x.png and other image for 6+ having higher resolution , name it as Demo@3x.png.So When the image is placed in imageview , It will automatically takes Demo@2x.png for 4s/5/6 and Demo@3x.png for 6+.

4s/5/6设备中的Imageview图像呈现为@2x,而6+设备的图像呈现为@3x。取一个图像,命名为Demo@2x。png和其他具有更高分辨率的图像,命名为Demo@3x.png。因此,当图像被放置在imageview中时,它将自动接受Demo@2x。4 /5/6和Demo@3x。为6 + png。

#3


0  

you need special size for each device by using image.xcassets.And this will help you alot - https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

通过使用image.xcassets,您需要为每个设备设置特殊的大小。这将帮助您—https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

#1


1  

In iOS8, you can use different size classes for different screens

在iOS8中,可以为不同的屏幕使用不同大小的类

use this post to begin.

使用这篇文章开始。

Also refer this for more info about using different graphics for varying resolution.

关于使用不同的图形以获得不同分辨率的更多信息,请参考本文。

#2


0  

The image in Imageview in 4s/5/6 devices render at @2x while that in 6+ it renders at @3x.So take an image and name it as Demo@2x.png and other image for 6+ having higher resolution , name it as Demo@3x.png.So When the image is placed in imageview , It will automatically takes Demo@2x.png for 4s/5/6 and Demo@3x.png for 6+.

4s/5/6设备中的Imageview图像呈现为@2x,而6+设备的图像呈现为@3x。取一个图像,命名为Demo@2x。png和其他具有更高分辨率的图像,命名为Demo@3x.png。因此,当图像被放置在imageview中时,它将自动接受Demo@2x。4 /5/6和Demo@3x。为6 + png。

#3


0  

you need special size for each device by using image.xcassets.And this will help you alot - https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html

通过使用image.xcassets,您需要为每个设备设置特殊的大小。这将帮助您—https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html