简体   繁体   English

iOS iPhone版本:全尺寸背景图像分辨率

[英]iOS iPhone release: full size background image resolutions

I have a simple, single view app. 我有一个简单的单一视图应用程序。 I have an image which is to be used as the full background. 我有一个图像,可以用作完整的背景。 Currently, i have edited the image for both portrait & landscape, in standard (414 X 736) & retina (1242 X 2208). 目前,我已经编辑了标准(414 X 736)和视网膜(1242 X 2208)的肖像和风景图像。

When i use iOS simulator, the background appears fine in all of the devices (4s > 6 plus). 当我使用iOS模拟器时,背景在所有设备中都显示正常(4s> 6 plus)。 However i'm unsure about if this will hold out when launched/released. 但是我不确定这是否会在启动/发布时保持不变。

Do i need to provide the image in all different resolutions for each device in my final app? 我是否需要在最终应用中为每个设备提供所有不同分辨率的图像?

eg imagePortrait4s.png , imagePortrait5.png , imagePortrait6.png , imagePortrait6plus.png etc 例如imagePortrait4s.pngimagePortrait5.pngimagePortrait6.pngimagePortrait6plus.png

this might help a bit. 这可能会有所帮助。 I can't tell yet... 我还说不出来......

UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:_Image];
[backgroundImageView setFrame:[[self view] bounds]];
[[self view] addSubview:backgroundImageView];
//I EXCPECTED THIS NEXT LINE OF CODE TO WORK TO SET A SEPARATE BACKGROUND FOR IPAD...
UIImage *Image = [[UIImage alloc]init];
if ([[UIScreen mainScreen] bounds].size.height == 480) {
    // iPhone, iPod Touch
    Image = [UIImage imageNamed:@"cheetah2.png"];
}
if ([[UIScreen mainScreen] bounds].size.height == 568) {
    // iPhone 5
    Image = [UIImage imageNamed:@"cheetah2.png"];
}
if ([[UIScreen mainScreen] bounds].size.height == 1024) {
    // iPad
    Image = [UIImage imageNamed:@"cheetah2.png"];
}
self.view.backgroundColor = [UIColor colorWithPatternImage:Image];

I have a number of apps in the App Store that only use one image -- the highest resolution one. 我在App Store中有许多应用程序只使用一个图像 - 最高分辨率的图像。 They scale down fine in practice (on any device). 它们在实践中缩小(在任何设备上)。 For one background image, you shouldn't see any difference (other than resolution on a non-Retina device). 对于一个背景图像,您不应该看到任何差异(非Retina设备上的分辨率)。

If you make sure your image is set to "Scale to Fill" it will look good and fill the screen no matter what orientation or device size the user has. 如果您确保将图像设置为“缩放到填充”,则无论用户具有何种方向或设备尺寸,它都会看起来很好并填满屏幕。 (Make sure the important focus of the background is toward the center, because depending on the device, certain edges will be cut off). (确保背景的重要焦点朝向中心,因为根据设备的不同,某些边缘会被切除)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM