2012-11-08 25 views
1

我正在研究一款適用於iPhone 5及更低版本的應用程序。iPhone 5圖像的命名約定?

的圖像,我用這個代碼

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圖像的命名約定?

在此先感謝 馬諾

回答

6

[email protected]這將是你所需要的啓動圖像,您需要添加[email protected]所有你的iPhone 5的圖像結束,但也出現了與命名規範的問題。

我發現這樣做有幫助。

[pBackgroundImageView setImage:[UIImage imageNamed:(IS_PHONE5()) ? @"[email protected]" : @"myimage.png"]]; 

的問題是它不挑[email protected]了,但這樣的事情應該是這樣。 得到IS_PHONE5變量添加

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

思考,這可能幫助任何人想知道關於支持高分辨率手機和iPhone 5

Supporting high resolution and iPhone 5