This seems like it should be simple, but it is proving to have a lot of challenging nuances - and I haven't found an answer elsewhere on Stack Overflow that answers this fully, clearly, and simply.
In a nutshell - I have an iPad application that uses storyboards to layout the application flow, and a split view controller as the primary root view controller.
This application checks at startup if there are login credentials stored, and if they are it jumps straight to the UI, and if not it presents a full-screen login page.
The challenge though - where should this conditional check be made, and how should the login screen been instantiated?
I have tried every permutation I can think of.
In the app delegate seems like the obvious place, but calling segues or modal popups seem to be ignored because the views from the storyboard are not yet live.
In the launch methods for the split view's detail controller seems the next obvious place.
The closest to working solution I can find is described here: https://stackoverflow.com/a/8224389/529774
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"Login"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:vc animated:NO];
}
But with this implementation, called by the split view's detail view controller, the underlying split view flashes briefly on the screen.
If I change from viewDidAppear to viewWillAppear, there is no flash - but the login view ends up drawing in portrait even if the screen is rotated to landscape.
As I said - this sort of conditional login display seems like it should be common and easy, but I just can't find a simple working example anywhere that combines a split view, storyboards, rotation awareness, and which keeps the UI from flashing.
Any tips? Pointers to good working examples?