iPhone 5图片的命名约定? [英] Naming convention for iPhone 5 images?

查看:66
本文介绍了iPhone 5图片的命名约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发适用于iPhone 5及更低版本的应用.

I am working on an app that would be for iPhone 5 and lower.

对于我正在使用此代码的图像

for images I am using this code

CGRect mainFrame = [[UIScreen mainScreen] bounds];

int imgIndex = arc4random() % 10 + 1;

if(mainFrame.size.height > 480)
    [pBackgroundImageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"dreams 1136x640 %d.jpg",imgIndex]]];
else
    [pBackgroundImageView setImage:[UIImage imageNamed:[NSString stringWithFormat:@"dreams_960x640_%d.jpg",imgIndex]]];

但我对此不满意.

iphone 5图像是否有特定的命名约定?

is there any specific naming convention for iphone 5 images?

先谢谢了 马诺

推荐答案

Default-568h@2x.png这将是您需要的启动图像,您需要在所有iPhone 5图像的末尾添加-568h@2x,但是命名约定问题.

Default-568h@2x.png this would be the launch image you need, you need to add -568h@2x to the end of all your iPhone 5 images, but there have been issues with the naming convention.

我发现这样做很有帮助.

I found doing it like this has helped.

   [pBackgroundImageView setImage:[UIImage imageNamed:(IS_PHONE5()) ? @"myimage-568h@2x.png" : @"myimage.png"]];

问题在于它不能拾取-568h@2x,但这是应该的. 获取IS_PHONE5变量add

The issue is it doesn't pick the -568h@2x up but this is the way it should be. to get the IS_PHONE5 variable add

   #define IS_PHONE5() ([UIScreen mainScreen].bounds.size.height == 568.0f && [UIScreen mainScreen].scale == 2.f && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

这样可以帮助任何想知道支持高分辨率手机和iPhone 5的人

Thought this may help anyone wondering about supporting high resolution phones and iPhone 5

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆