【发布时间】:2015-11-17 02:30:09
【问题描述】:
使用 iOS 8.3
我有一个横向模式的视图,我正在尝试打开一个仅纵向视图控制器。每次我尝试打开它时,应用程序都会崩溃。
我已阅读此official apple answer,它基本上建议您执行以下操作:
在应用委托中:
@implementation AppDelegate
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
else /* iphone */
return UIInterfaceOrientationMaskAllButUpsideDown;
}
在我的控制器中:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
所以我有,但我仍然收到这个崩溃消息:
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES
在项目常规设置中,我有以下内容(不应根据苹果的回答进行更改):
我可以看到这些函数实际上正在被调用,但没有任何帮助。 有什么想法吗?
我之前读到的一些问题:
How to force a UIViewController to Portrait orientation in iOS 6
iOS6: supportedInterfaceOrientations not working (is invoked but the interface still rotates)
【问题讨论】:
-
在 Xcode 中,除了两个横向方向外,还要检查纵向(尽管您评论说 Apple 声称它不应该更改)。
-
@rmaddy,我还有其他具有此配置的应用程序,确实应该将其标记出来,否则应用程序以纵向模式启动(并切片应用程序),所以这是不可能的。
标签: ios objective-c iphone uiimagepickercontroller