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) 如果你只是要把竖屏的播放器,做成支持横屏 ...
随机推荐
- HDU 1198
http://acm.hdu.edu.cn/showproblem.php?pid=1198 裸并查集,主要工作在根据题目给出关系构图 #include <iostream> #inclu ...
- 實驗項目wordcount
wordcount 1.设计思路 第一步 :主函数参数使用命令行参数,定义一个文件指针fp. 第二步:判断能否用只读的形式打开命令行指针中的文件,并让指针指向打开函数,若不能则输出不能读取文件,否则下 ...
- 响应: 500 OOPS: priv_sock_get_int 错误: 读取目录列表失败
/************************************************************************* * 响应: 500 OOPS: priv_sock ...
- vue图片上传组件
前言:很多项目中都需要用到图片上传功能,而其多处使用的要求,为了避免重复造轮子,让我决定花费一些时间去深入了解,最终封装了一个vue的图片上传组件.现将总结再次,希望有帮助. Layout <d ...
- iPhone设备及屏幕适配
// // Common.h // 微信 // // #ifndef Common_h #define Common_h // iPhone设备及屏幕适配 //4的设备 #define KDevice ...
- 报表生成poi----java操作java对象生成execl表单
1.Apache POI简介 Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程式对Microsoft Office格式档案读和写的功能. .NET的开发人员则 ...
- R学习笔记 ---- 系列文章
R实战 开篇:介绍R的使用 R学习笔记 第五篇:字符串操作 R学习笔记 第六篇:数据变换和清理 R学习笔记 第四篇:函数,分支和循环 R学习笔记 第三篇:数据框 R学习笔记 第二篇:矩阵.数组和列表 ...
- Phonegap 开发环境搭建
以Android为例介绍Phonegap开发环境搭建 一. 软件下载 1. JDK 8 下载 http://www.oracle.com/technetwork/java/javase/downloa ...
- 教你判断一个APP页面是原生的还是H5页面 。(还没看)
来源:https://www.25xt.com/appdesign/11851.html 刚好是周末,无意之间学堂君在收集相关资料的时候,发现有部分童鞋在问<如何判断一个APP页面是不是H5页面 ...
- pythonNet day07
信号 一个进程向另外一个进程通过信号的方式传递某种讯息,接收方在接收到信号后作出相应的处理 查看信号:kill -l kill -signum PID 给PID的进程发送一个信号 信号名称:信号的名字 ...