我使用的是iOS 5和XCode 4.2。编码后,我给出了横向和纵向的支持。它工作正常。但是当我在XCode 4.5 iOS 6中使用代码时,不支持方向。
有人知道原因吗?
发布于 2013-09-11 13:17:32
请检查您的项目设置(摘要)
允许的方向的支持的接口方向设置

或
尝试使用以下代码锁定方向:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown );
}发布于 2013-09-11 14:22:03
它的正确与否我不知道。但我暂时使用了这种方法。如果它有用,你也可以使用它。
您可以在Appdelegate中编写此方法。
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
[navigationController.topViewController shouldAutorotate];
return UIInterfaceOrientationMaskAll;
}您可以在viewController中编写- (BOOL)shouldAutorotate方法。
https://stackoverflow.com/questions/18733014
复制相似问题