[Question updated]
So, here is the problem, I finally narrowed it down. If you create a new UIViewController in all methods
- (id)init; - (void)loadView; - (void)viewDidAppear:(BOOL)animated; - (void)viewDidLoad; (...)
Standard interface Orientation is a portrait, and if landscape mode is detected, it will quickly turn to that orientation. Which can be detected with:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;
The problem is that on the iPad it is very difficult to prepare the interface for the current interface orientation in loadView (or one of the others), since it will only return the portrait. This will cause several problems:
1) I want my content to reload in portait mode, but NOT in landscape mode. Normally I would put an if statement in loadView. If in portrait mode, reload the content. But in this case, he will always return the portrait and, thus, always downloads the content.
2) I want to use the presentPopoverFromRect: inView: allowedArrowDirections: animated: 'method - in portrait mode so that it automatically displays a pop-up menu when the application starts. This will cause the application to crash when launched in portrait mode. Reason: "Popovers cannot be imagined from a point of view that does not have a window."
The only safe guess is inside 'didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation', but this method will not run if it starts in portrait mode.
// ----
Update (15.37)
'UIApplicationWillChangeStatusBarOrientationNotification'
It will be published only if the user switches from portrait to landscape (or vice versa). If the interface was a problem, then this can be easily solved by observing this notification and
if (UIDeviceOrientationIsPortrait(interfaceOrientation)) { // layout subviews for portrait mode } else { // layout subviews for landscape mode }
But the problem is that I want to know what mode it is at startup to determine if it is more likely or not. I have to reload the content, I can not reload the content and when it changes to landscape, cancel it.