Presenting a UIViewController when on landscape orientation
-
23-06-2021 - |
Question
What is the best way to show a UIViewController only when the device is on landscape mode? The modal view controller should present itself modally when the device is on landscape mode and should dismiss itself when going back to portrait.
Since - (BOOL)shouldAutorotateToInterfaceOrientation :(UIInterfaceOrientation)toInterfaceOrientation
is only called once (and not for every UIViewController
), how should the navigation controller be set up?
Solution
The method you're looking for is
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)o duration:(NSTimeInterval)t;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow