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);
}