Handling iOS device rotation programmatically
-
23-04-2021 - |
Question
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?
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow