我在IPad> ios8.0上遇到问题。 在纵向模式下,所有工作正常。但是当我以横向模式启动应用程序时,它会出错 - http://prntscr.com/72huah
我在主ViewController中使用xib:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationPortrait;
}
- (BOOL)shouldAutorotate {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
return YES;
return NO;
}
答案 0 :(得分:0)
应用启动图像在视图后不会旋转(iOS不会这样做)。您可以添加 UIImageView 并在 UIInterfaceOrientation 的基础上旋转它。几次之后你可以删除Launch UIImageView。
- (BOOL)shouldAutorotate {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight){
//Set LandScape Image to UIImageView
return YES;
}
//Set Portrait Image to UIImageView
return NO;
}