首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自动旋转不工作ios6.1

自动旋转不工作ios6.1
EN

Stack Overflow用户
提问于 2013-04-08 15:10:06
回答 3查看 132关注 0票数 0

自动旋转在ios6.1中不起作用。但下面的代码在其他应用程序中是有效的。

代码:

代码语言:javascript
复制
@implementation UINavigationController (RotationIn_IOS6)

-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
}

-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject]  preferredInterfaceOrientationForPresentation];
}

@end


- (BOOL)shouldAutorotate
{
    //returns true if want to allow orientation change
    return TRUE;


}
- (NSUInteger)supportedInterfaceOrientations
{
    //decide number of origination tob supported by Viewcontroller.
    return UIInterfaceOrientationMaskAll;


}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    //from here you Should try to Preferred orientation for ViewController

    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationPortrait;
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)  interfaceOrientation duration:(NSTimeInterval)duration
{

}
EN

回答 3

Stack Overflow用户

发布于 2013-04-08 16:23:04

尝试设置支持的方向字段。

票数 1
EN

Stack Overflow用户

发布于 2013-04-08 15:45:11

你试过修改plist吗?

票数 0
EN

Stack Overflow用户

发布于 2013-04-09 17:02:37

请检查您的项目目标,如下所示

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

https://stackoverflow.com/questions/15873231

复制
相关文章

相似问题

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