支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES' [英] Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

查看:881
本文介绍了支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序(iPad; iOS 6)是仅限横向应用程序,但是当我尝试使用UIPopoverController显示照片库时,它会抛出此错误:
支持的方向没有共同的方向与应用程序,并且shouldAutorotate返回YES。我已经尝试更改了很多代码,但我没有运气。

My app (iPad;iOS 6) is a landscape only application, but when I try using a UIPopoverController to display the photo library it throws this error: Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES. I've tried changing a lot of the code around but I've had no luck.

推荐答案

在IOS6中,您已在三个位置支持接口方向:

In IOS6 you have supported interface orientations in three places:


  1. .plist(或目标)摘要屏幕)

  2. 您的UIApplicationDelegate

  3. 正在显示的UIViewController

如果您收到此错误,很可能是因为您在UIPopover中加载的视图仅支持纵向模式。这可能是由Game Center,iAd或您自己的视图引起的。

If you are getting this error it is most likely because the view you are loading in your UIPopover only supports portrait mode. This can be caused by Game Center, iAd, or your own view.

如果它是您自己的视图,您可以通过覆盖UIViewController上的supportedInterfaceOrientations来修复它:

If it is your own view, you can fix it by overriding supportedInterfaceOrientations on your UIViewController:

- (NSUInteger) supportedInterfaceOrientations
{
     //Because your app is only landscape, your view controller for the view in your
     // popover needs to support only landscape
     return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}

如果不是您自己的观点(例如iPhone上的GameCenter),你需要确保你的.plist支持肖像模式。您还需要确保UIApplicationDelegate支持以纵向模式显示的视图。您可以通过编辑.plist然后覆盖UIApplicationDelegate上的supportedInterfaceOrientation来执行此操作:

If it is not your own view (such as GameCenter on the iPhone), you need to make sure your .plist supports portrait mode. You also need to make sure your UIApplicationDelegate supports views that are displayed in portrait mode. You can do this by editing your .plist and then overriding the supportedInterfaceOrientation on your UIApplicationDelegate:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}

这篇关于支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆