ios 屏幕方向的设置

ref: http://www.cnblogs.com/niit-soft-518/p/5611298.html

实际的项目需求。root是TabBarController,里面有4个navigationController,现在要锁死所有页面的屏幕方向

try 1:继承navigation:然并卵

try 2: 继承tabbarcontroller:然并卵

try 3: 继承navigation,tabbar:然并卵

result:iOS9设置无效,iOS8以下,只需设置tabbar,只设置navigation没用

最后:iOS9以下的锁死实现:

#import "RootTabbarViewController.h"

@interface RootTabbarViewController ()

@end

@implementation RootTabbarViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
} //是否可以旋转
- (BOOL)shouldAutorotate
{
NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
//读取保存的数据
NSUInteger *isLock =[defaults integerForKey:@"ScreenLockSetting"];
if(isLock==YES){
return NO;
}else return YES;
//return isLock; } //优先竖屏
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
上一篇:给Linux系统新增加一块硬盘


下一篇:LoadRunner 11 安装及破解(转)