Push UIViewController with different orientation to previous
转自:http://stackoverflow.com/questions/6695837/push-uiviewcontroller-with-different-orientation-to-previous
参考:http://stackoverflow.com/questions/15947349/how-to-handle-different-orientations-in-ios/16022631#16022631
It makes no sense to use a UINavigationController
push transition to present a view in a different orientation. Which way round would the navigation bar / toolbar be?
Presenting a modal view controller is the right way to go about this. If this causes the status bar to become hidden, make sure yourModalViewController.wantsFullScreenLayout
is NO
.
Using -[UIDevice setOrientation:] is a private API, and will get your application rejected. See this question. What you ask is not possible using public API and is also not recommended from HIG standpoint. What is supported and you should implement, is modal presentation of the different view controllers with different supported interface orientation. This is why the default implementation of UINavigationController is to always rotate; it assumes all view controllers have the same supported interface orientations. Take for example video playback on iPhone. Open the video apps (that comes with iOS). The root view controller only supports portrait orientation. However, start a video, and a modal view controller pops up which only supports landscape interface orientations. This seems exactly the behavior you wish to achieve. This is why preferredInterfaceOrientationForPresentation is not called. preferredInterfaceOrientationForPresentation only gets called when using presentViewController:animated:. A small gotcha, if you require a navigation bar in each stage of your scene, you will need to enclose each modal view controller with a navigation controller. You can then pass the required data in prepareForSegue: by accessing topViewController of the navigation controller object in the segue. Here is an example project which behaves correctly according to your requirements (or at least will give you ideas how to implement): http://www.mediafire.com/?zw3qesn8w4v66hy
Push UIViewController with different orientation to previous的更多相关文章
- iOS屏幕旋转 浅析
一.两种orientation 了解屏幕旋转首先需要区分两种orientation 1.device orientation 设备的物理方向,由类型UIDeviceOrientation表示,当前设备 ...
- GeSHi Documentation
GeSHi Documentation Version 1.0.8.11 Authors: © 2004 - 2007 Nigel McNie © 2007 - 2012 Benny Baumann ...
- Tracing SQL Queries in Real Time for MySQL Databases using WinDbg and Basic Assembler Knowledge
https://www.codeproject.com/Articles/43305/Tracing-SQL-Queries-in-Real-Time-for-MySQL-Databas As ...
- MXNet源码分析 | KVStore进程间通信
本文主要基于MXNet1.6.0版本进行分析. 在上一篇文章中,我们分析了MXNet中KVStore的进程内通信机制.在这篇文章中,我们主要分析KVStore如何进行多节点分布式通信. 在KVStor ...
- UIViewController push或presentViewController 弹出方式
//导航控制器数量 add xjz 判断是push还是present出来的 NSArray *viewcontrollers = self.navigationController.viewContr ...
- ios swift 判断uiviewcontroller时push present 进来的 还是pop进来的
override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) //显示navbar self.navi ...
- IOS - Create Push Segue Animation Without UINavigationController
APPLE提供了三种storyboard segue的方式:push,modal,custom . push segue是系统预定义的跳转方式, 为了使其能正常工作,我们还必须加载UINavigati ...
- UIViewController所有API的学习。
<欢迎大家加入iOS开发学习交流群:QQ529560119> /* UIViewController is a generic controller base class tha ...
- Mobile Push Notification
In one embodiment, a method includes sending to a mobile client computing device a first notificatio ...
随机推荐
- 【DB2】监控动态SQL语句
一.db2监控动态SQL(快照监控) db2示例用户登陆后,使用脚本语句db2 get snapshot for all on dbname>snap.out 也可以使用db2 get snap ...
- LS下怎样最大限度的提高Domino下Web应用的速度
1.用For 循环代替Do 循环,因为Do循环会反复的计算条件! 2.在数族元素中循环式用Forall代替for.一元数组会快75%,二元会快50%左右. 3.简化If里的条件,如:if a=x an ...
- 监听textarea文本框文本输入情况
// When the value of the text area changes... $("textarea").on("input", function ...
- 自己开发Visual studio插件-一个nvelocity高亮插件
首先,有一个项目用到了nvelocity模板引擎,但是用vs开发模板的时候,没有高亮效果,所以非常不方便,鉴于这个,于是有了自己开发插件的念头,但是在vs sdk开发上面,这方面的资料真是少之又少,网 ...
- Swift中的Any 与 AnyObject、AnyClass的区别?
在 Swift 中能够表示 “任意” 这个概念的除了Any .AnyObject以外,还有一个AnyClass. Any.AnyObject.AnyClass有什么区别: AnyObject是一个成员 ...
- iOS设置圆角的四种方法
小小圆角问题,正常情况下,我们不需要过多关心,但当屏幕内比较多的时候,还是有必要了解下性能问题的 一.设置CALayer的cornerRadius 这是最常用的,也是最简单的. cornerRadiu ...
- 关于 Dropout 防止过拟合的问题
关于 Dropout 可以防止过拟合,出处:深度学习领域大神 Hinton,在2012年文献:<Improving neural networks by preventing co-adapta ...
- Android MD5校验码的生成与算法实现
在Java中,java.security.MessageDigest (rt.jar中)已经定义了 MD5 的计算,所以我们只需要简单地调用即可得到 MD5 的128 位整数.然后将此 128 位计 ...
- 搞不懂为什么开发人员爱iOS恨Android?
导读:很多网站发表文章大同小异.唯有这个不同点,给大家分享. Android和iOS的较量一直都是人们津津乐道的话题.两个平台各有各的优势所在,同时也都力图能在各个方面赶超对手.对于用户来说,青菜萝卜 ...
- ASP.NET Core Linux环境安装并运行项目
原文地址:https://blog.csdn.net/u014368040/article/details/79192622 一 安装环境 1. 从微软官网下载 Linux版本的.NetCoreSd ...