ios 6中如何禁止横屏

ck89757 2012-11-20 04:02:04
ios 6中如何禁止横屏

- (BOOL)shouldAutorotate

{

return NO;

}

把plist里面的Supported interface orientation 相关横屏的设置删掉后


- (BOOL)shouldAutorotateToInterfaceOrientation:UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}


以上方法都试过了,无效
...全文
1145 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
JieCh121599 2012-11-21
  • 打赏
  • 举报
回复
你这个方法是全局都不能横屏吧。。好牵强的结贴理由。。呵呵
ck89757 2012-11-20
  • 打赏
  • 举报
回复
在AppDelegate中增加,这个方法可以禁止横屏 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskPortrait; }
JieCh121599 2012-11-20
  • 打赏
  • 举报
回复
In ios6 禁止横屏, - (BOOL)shouldAutorotate { return NO; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } 建议你参考 blog.csdn.net/totogogo/article/details/8002173
多鱼的夏天 2012-11-20
  • 打赏
  • 举报
回复
1. 可以在项目属性(高版本的xcode)里把两个方向的横屏设置为禁止 2. 这个方法是可以用的,如果不能用,可能是哪里出了问题

- (BOOL)shouldAutorotateToInterfaceOrientation:UIInterfaceOrientation)interfaceOrientation
{
    return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧