简体   繁体   English

以编程方式处理iOS设备旋转

[英]Handling iOS device rotation programmatically

I'm working on my app that is based on a navigationController, all programatically, no XIBs. 我正在开发基于navigationController的应用程序,所有程序均以编程方式提供,没有XIB。 Before, when I used XIBs, I would set springs & struts. 以前,当我使用XIB时,我会设置springs & struts. like so 像这样

But now my app is all programmatically done, so, how can I manage the rotations? 但是现在我的应用程序已全部通过编程完成,那么,如何管理轮换? Is there any tutorial with this? 有这个教程吗?

Do I have to create two different view controllers for each view? 我必须为每个视图创建两个不同的视图控制器吗? Or according to orientation in the same view controller show the UI elements? 还是根据方向在同一视图控制器中显示UI元素?

The springs and struts in a nib control the autoresizingMask property of the UIView . 笔尖中的弹簧和支柱控制UIViewautoresizingMask属性 You can set them programatically. 您可以通过编程设置它们。 This is explained further in the “Handling Layout Changes Automatically Using Resizing Rules” section of the *View Programming Guide for iOS . *适用于iOS的* View编程指南中的“使用调整大小规则自动处理布局更改”部分对此做了进一步说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM