我的方向设置为横向,iphone模拟器以横向模式加载和启动我的应用程序。由于ios6上面的代码以纵向模式而不是横向模式加载图像。请指教。仅在ios6中以纵向模式显示图片
编辑:问题从这里开始:
- (void)viewDidLoad {
[super viewDidLoad];
[self.view setBackgroundColor:[[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"480x320-background.png"]]];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)anInterfaceOrientation{
return anInterfaceOrientation==UIInterfaceOrientationLandscapeLeft || anInterfaceOrientation==UIInterfaceOrientationLandscapeRight;
}
题外话:我建议使用ARC。 – dasdom
这段代码看起来不错。该错误必须在其他地方。您是否已设置supportedInterfaceOrientations(http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/supportedInterfaceOrientations)? – dasdom
我更新了代码。我刚刚发现问题在我最初发布的代码之前开始。 – Segev