在我的FirstViewController我,如果设备是iPhone4的或iPhone5的写开关背景下面的代码:
文件名:bg-for5-568@2x.png
bg-for4@2x.png
bg-for4.png
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage *backgroundImage = [[UIImage alloc] init];
if([[UIScreen mainScreen]bounds].size.height == 568)
{
backgroundImage = [UIImage imageNamed:@"bg-for5-568h"];
}
else
{
backgroundImage = [UIImage imageNamed:@"bg-for4"];
}
self.view.backgroundColor = [[[UIColor alloc] initWithPatternImage:backgroundImage] autorelease];
[backgroundImage release];
}
Run Code Online (Sandbox Code Playgroud)
当我在我的模拟器上隐藏应用程序时,iphone5的背景显示双倍大小,在视图之外.
/*谢谢你*/