这是我在 ipad iOS6 中指定背景的代码,
- (void)viewDidLoad
{
if ([[UIScreen mainScreen] bounds].size.height == 1024)
{
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"homeipad.png"]];
}
else if ([[UIScreen mainScreen] bounds].size.height == 768)
{
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"landscapipad.png"]];
}
}
它不会改变取决于方向?我已经包括
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
如何在 ipad 中为相应的方向分配特定的背景图像?