简体   繁体   中英

Handling iOS device rotation programmatically

I'm working on my app that is based on a navigationController, all programatically, no XIBs. Before, when I used XIBs, I would set 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?

The springs and struts in a nib control the autoresizingMask property of the UIView . 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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