首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xcode4.5: SupportedInterfaceOrientation不工作

Xcode4.5: SupportedInterfaceOrientation不工作
EN

Stack Overflow用户
提问于 2013-09-11 13:02:49
回答 2查看 162关注 0票数 1

我使用的是iOS 5XCode 4.2。编码后,我给出了横向和纵向的支持。它工作正常。但是当我在XCode 4.5 iOS 6中使用代码时,不支持方向。

有人知道原因吗?

EN

回答 2

Stack Overflow用户

发布于 2013-09-11 13:17:32

请检查您的项目设置(摘要)

允许的方向的支持的接口方向设置

尝试使用以下代码锁定方向:

代码语言:javascript
复制
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown );
}
票数 2
EN

Stack Overflow用户

发布于 2013-09-11 14:22:03

它的正确与否我不知道。但我暂时使用了这种方法。如果它有用,你也可以使用它。

您可以在Appdelegate中编写此方法。

代码语言:javascript
复制
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
 [navigationController.topViewController shouldAutorotate];
 return UIInterfaceOrientationMaskAll;
}

您可以在viewController中编写- (BOOL)shouldAutorotate方法。

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

https://stackoverflow.com/questions/18733014

复制
相关文章

相似问题

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