首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

ios 6中怎么禁止横屏

2012-12-15 
ios 6中如何禁止横屏ios 6中如何禁止横屏- (BOOL)shouldAutorotate{return NO}把plist里面的Supported in

ios 6中如何禁止横屏
ios 6中如何禁止横屏

- (BOOL)shouldAutorotate

{

return NO;

}

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


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


以上方法都试过了,无效
[解决办法]
1. 可以在项目属性(高版本的xcode)里把两个方向的横屏设置为禁止


2. 这个方法是可以用的,如果不能用,可能是哪里出了问题


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

[解决办法]
In ios6 禁止横屏,
- (BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
  return UIInterfaceOrientationMaskPortrait;
}

建议你参考 blog.csdn.net/totogogo/article/details/8002173
[解决办法]
在AppDelegate中增加,这个方法可以禁止横屏

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window  
    {  
         return UIInterfaceOrientationMaskPortrait;  
    }
[解决办法]
你这个方法是全局都不能横屏吧。。好牵强的结贴理由。。呵呵

热点排行