首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >iOS 6中的UIPopoverController定向崩溃

iOS 6中的UIPopoverController定向崩溃
EN

Stack Overflow用户
提问于 2012-08-13 14:02:02
回答 5查看 6.5K关注 0票数 17

我目前的程序只支持横向。

在iOS 6中,它在UIPopoverController上崩溃。

'UIApplicationInvalidInterfaceOrientation',原因:‘支持的方向与应用程序没有共同的方向,shouldAutorotate返回YES’

我为项目启用了所有方向,它工作得很好。但是,我需要对所有视图进行大量更改,以仅支持横向视图。

有没有其他简单的方法来修复UIPopoverController中的UIOrientation

EN

回答 5

Stack Overflow用户

发布于 2012-09-21 13:37:52

尝试将以下内容添加到UIApplicationDelegate

代码语言:javascript
复制
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationMaskAll;
}

您仍然可以在Info.plist文件中设置受支持的接口方向,并在每个视图控制器的supportedInterfaceOrientations:方法中返回一个掩码。

票数 0
EN

Stack Overflow用户

发布于 2012-09-24 11:49:25

新建UIImagePickerController的一个子类,并添加以下代码:

代码语言:javascript
复制
@property (nonatomic)NSUInteger supportedInterfaceOrientations;

-(NSUInteger)supportedInterfaceOrientations{
    return _supportedInterfaceOrientations;
}
-(BOOL)shouldAutorotate{
    return YES;
}

像这样使用它:

代码语言:javascript
复制
    if (imagePickerController==nil) {
        imagePickerController = [[WUIImagePickerController alloc]init];//the subclass
        imagePickerController.delegate = self;
        imagePickerController.supportedInterfaceOrientations = UIInterfaceOrientationMaskLandscapeRight;//any orientation you want to set
        if (popoverController==nil) {
            popoverController = [[UIPopoverController alloc]initWithContentViewController:imagePickerController];
        }
    }

谁知道更好的方法,请告诉我。

票数 0
EN

Stack Overflow用户

发布于 2012-10-16 17:34:05

这就是link。您必须将应用程序设置为在开始时支持所有方向。在应用程序委派中进行更改。

代码语言:javascript
复制
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window

{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskAll;
    else  /* iphone */
        return UIInterfaceOrientationMaskAllButUpsideDown;

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11928885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档