when you implement the UINavigationController, this class is your parent that controls all the child viewControllers that will be pushed onto the stack. Thus, RootViewController is the only controller that says βYesβ or βNoβ autorotation. Even if you pass Yes for automatic rotation in the child view controllers, they do not count!
This is the character of the UINavigationController. To change it, you have two options:
1- Manually manipulate it, which requires you to go through bulky codes.
2 Modify the design to be more compatible with the UINavigationController. This is the only view that needs to rotate, it must be called by the RootViewController (and not the root navigation controller - they are called the same, but completely different), the view in which the NavController is located. And when the device rotates, it either clicks the NavController on the view, or another.
3 Another method, which will also work, but is not recommended, since it violates the concept of MVC, is that your NavController can listen to notifications. This particular kind of child, which MAY and SHOULD rotate, may file a notification - for example. rotateMe, and as soon as the NavController hears it, it rotates.
As I said, it will work, but it violates the MVC model - this is good for Apple, but not recommended from a programming point of view.
If you need further explanation on any of them, please let me know.
Canopus
source share