I am trying to implement automatic rotation in my application, which is basically a UINavigationController with a lot of UIViewControllers that click on it.
I copied this to my first UIViewController (which falls into the UINavigationController):
- (BOOL) shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation) interfaceOrientation {
return YES;
}
Everything worked fine ... However, if I paste this code into the second UIViewController (the first clicks from above after clicking one button) - autorotation will not work. shouldAutorotateToInterfaceOrientation is called when the UIViewController is first initialized, but after it is visible and I rotate the device, nothing happens.
Thus, the result: the first view is well rotated - portrait / landscape ... but after I press the button and go into the second view, I remain in this portrait or landscape, no matter what is active.
I tried subclassing the UINavigationController and set toAutorotateToInterfaceOrientation there, but that also doesn't work.
What am I doing wrong?
source
share