Justin
Justin

Reputation: 2999

Modal view after start app does not appear

Before the users can use my app the have to login. My idea was that after the app starts the login view appears modally.

Before iOS 5 I had it all working with .xib files. Now I want to convert the views to a Storyboard for overview and better use of the new functionalities.

The app works with a splitview controller. The problem is that the login view is loaded, but never appears.

I tried it in the app delegate and I made a class for the splitviewcontroller and tried to load it in the viewDidLoad.

Code:

- (void)viewDidLoad
{
    [super viewDidLoad];

    //load and push login
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    LoginViewController *loginViewController = [storyboard instantiateViewControllerWithIdentifier:@"loginViewController"];

    NSLog(@"login push: %@", loginViewController);
    [self presentModalViewController:loginViewController animated:YES];
    NSLog(@"done push");
}

Log:

2012-01-13 10:18:08.217 App[1101:707] login push: <LoginViewController: 0x472fe0>
2012-01-13 10:18:08.330 App[1101:707] done push

I tried to load it in the Root or detail view, it works but its not the right place and xcode gives the message:

2012-01-13 10:18:08.807 App[1101:707] Unbalanced calls to begin/end appearance transitions for <MainSplitViewController: 0x464bc0>.

My first idea is to begin with the login view and after login push the splitview controller. But I found out that the splitview controller has to be the root view.

Upvotes: 0

Views: 871

Answers (1)

Tom
Tom

Reputation: 1349

To push another ViewController in viewDidLoad is very early. Maybe the current ViewController is presented with animation and you try to present another ViewController with animation ...

You should try moving the display of your LoginController to viewDidAppear ...

Upvotes: 3

Related Questions