标签:
首先在plist 文件中 Supported interface orientations 选项 只留下一个 portrait
屏幕强制横屏 使用以下代码
self.navigationController.view.transform = CGAffineTransformMakeRotation(M_PI/2);
self.navigationController.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[[UIApplication sharedApplication] setStatusBarHidden:YES];
返回正常竖屏显示时(在viewWillDisappear中添加)
self.navigationController.view.transform = CGAffineTransformIdentity;
self.navigationController.view.frame = [UIScreen mainScreen].bounds;
[[UIApplication sharedApplication] setStatusBarHidden:NO];
UIApplication 中 statusBarOrientation 属性在ios 9 中已经不能用了 项目中需要横屏的页面直接隐藏了状态栏。
资源转载自:http://www.cnblogs.com/jiackyan/p/3382734.html
标签:
原文地址:http://www.cnblogs.com/ceasar/p/5198817.html