ios 单个ViewController屏幕旋转
如果需要旋转的ViewController 使用了UINavigationController,对UINavigationController进行如下扩展
@implementation UINavigationController(shouldAutorotate)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return self.topViewController.shouldAutorotate;
}
- (NSUInteger)supportedInterfaceOrientations
{
return self.topViewController.supportedInterfaceOrientations;
} @end
需要旋转的ViewController设置
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
} - (BOOL)shouldAutorotate
{
return YES;
} - (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
其他不需要旋转的 ViewController设置,建议添加BaseViewController统一控制
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationPortrait;
}
ios 单个ViewController屏幕旋转的更多相关文章
- 处理iOS设备的屏幕旋转
某些情况下,不强制的给用户唯一的屏幕角度给用户.这样用户可以旋转手机得到不同的视觉体验. 最简单的就是safari,横看竖看都可以. 这时需要捕捉用户的屏幕旋转事件并处理.很简单,才两步.比把大象装冰 ...
- ios 不支持屏幕旋转
- (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; }
- iOS 设置随意屏幕旋转
方法一,通过控制器继承或分类实现: 在UITabBarController 的子类或分类中实现 - (BOOL)shouldAutorotate { return [self.selectedView ...
- iOS 中的屏幕旋转shouldAutorotate和supportedInterfaceOrientations的先后关系
这2个UIViewController的属性,都和旋转相关, 当设备发生旋转时,首先会查看根controller的shouldAutorotate是否允许旋转,如果允许,再通过 supportedIn ...
- iOS开发——检测屏幕旋转
步骤一.注册通知 1: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrien ...
- iOS学习笔记(3)— 屏幕旋转
一.屏幕旋转机制: iOS通过加速计判断当前的设备方向和屏幕旋转.当加速计检测到方向变化的时候,屏幕旋转的流程如下: 1.设备旋转时,系统接收到旋转事件. 2.系统将旋转事件通过AppDelegate ...
- IOS6屏幕旋转详解(自动旋转、手动旋转、兼容IOS6之前系统)
转自 http://blog.csdn.net/zzfsuiye/article/details/8251060 概述: 在iOS6之前的版本中,通常使用 shouldAutorotateToInte ...
- iPhone屏幕旋转
iPhone屏幕内容旋转 在iOS6之前的版本中,通常使用 shouldAutorotateToInterfaceOrientation 来单独控制某个UIViewController的方向,需要哪个 ...
- iOS实现屏幕旋转
iOS实现屏幕旋转有两种方式 1. 应用本身支持 2. 手动旋转UIView (这种方式我没找到旋转 系统控件的方法 如:键盘.导航.UIAlertView) 如果你只是要把竖屏的播放器,做成支持横屏 ...
随机推荐
- New Concept English Two 30 82
$课文80 水晶宫 867. Perhaps the most extraordinary building of the nineteeth century was the Crystal Pal ...
- memcache+php实现页面访问的加速
一.什么是memcache memcache是目前主流的一个高性能的分布式内存对象缓存系统:它以key-value形式在内存中存储数据.由于数据缓存在内存中,所以相比操作DB而言,它不需要解析SQL. ...
- python 编程中的一个关于图片的库 imageio (读取照片RGB内容,转换照片格式)
最近在看机器学习方面的东西,经常遇到需要把某个类型的照片中 RGB 内容读取出来, 在python中照片显示用matplotlib就可以做到,但是导入不同格式的照片,保持出不同格式的照片numpy, ...
- BZOJ4033: [HAOI2015]树上染色(树形DP)
4033: [HAOI2015]树上染色 Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 3461 Solved: 1473[Submit][Stat ...
- 51Nod 1049:最大子段和(dp)
1049 最大子段和 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 N个整数组成的序列a[1],a[2],a[3],-,a[n],求该序列如a[i]+ ...
- Spring Could与Dubbo、Docker、K8S
如果你是在一个中小型项目中应用Spring Cloud,那么你不需要太多的改造和适配,就可以实现微服务的基本功能.但是如果是在大型项目中实践微服务,可能会发现需要处理的问题还是比较多,尤其是项目中老代 ...
- open_input_file函数调用结构图(转)
open_input_file函数调用结构图(有些重复的函数调用就略掉了,大致是按流程往下的). 函数大致说明: AVFormatContext *avformat_alloc_context(voi ...
- 使用C++生成1-33中的6个随机数,无重复
生成1-33中的6个随机数,无重复 ------------------------------------------------------------------------ 方法1.每生成 ...
- 机器学习The Learning Problem——coursera简要总结
1.人类及动物的学习模式:观察->学习->技能 机器学习的模式:data->ML(机器学习)->skill 2.那什么是skill:技能是某种表现方法的增进 eg:stac ...
- 【python】python实例集<一>
#打开一个记事本 import os os.startfile('notepad.exe') #当前文件的根目录 import os print os.path.join(os.path.dirnam ...