2012-09-27 92 views
5

我有一个全屏幕渐变背景的iOs应用程序。现在,与iPhone 5的屏幕大小是不同的,当然我想支持第5和第4设备。iOS 6背景图像

推荐的方法是什么?

回答

1

从我挂在注释后

#import <sys/utsname.h> 

NSString* 
machineName() 
{ 
struct utsname systemInfo; 
uname(&systemInfo); 

return [NSString stringWithCString:systemInfo.machine 
          encoding:NSUTF8StringEncoding]; 
} 

结果应该是:

@"i386"  on the simulator 
@"iPod1,1" on iPod Touch 
@"iPod2,1" on iPod Touch Second Generation 
@"iPod3,1" on iPod Touch Third Generation 
@"iPod4,1" on iPod Touch Fourth Generation 
@"iPhone1,1" on iPhone 
@"iPhone1,2" on iPhone 3G 
@"iPhone2,1" on iPhone 3GS 
@"iPad1,1" on iPad 
@"iPad2,1" on iPad 2 
@"iPhone3,1" on iPhone 4 
@"iPhone4,1" on iPhone 4S 

我假定这将返回类似@“iPhone5,1”最新模型。然后,只需做这样

NSString *iphoneType = machineName(); 
if ([iphoneType [email protected]"iPhone5,1"]){ 
    //image for iphone 5 
} else { 
      //image for the rest 
} 

支票让我知道,如果可以算出

+1

计划的方式是明确的。可能它有什么“通过Apple批准”? 喜欢用@xxx名字等图像 –

+0

你是说整个背景是一个图像? – TheJer

+0

假定它是:) –