presentModalViewController in viewDidLoad on first launch

Giles Van Gruisen picture Giles Van Gruisen · Jan 4, 2010 · Viewed 9.6k times · Source

I've been searching around but unfortunately have had no luck.

My app requires the user to sign in/sign up the first time he or she launches the app. I know how to determine first launch (using NSUserDefaults) but whenever I try to present the modal containing the sign in/ sign up controls, nothing happens.

Here's what I have:

-(void)viewDidLoad {
    [self showLogin];
    [super viewDidLoad];
}

-(void)showLogin {    
    FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"AccountView" bundle:nil];
    controller.delegate = self;

    controller.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:controller animated:YES];

    [controller release];
}

However, nothing happens. The main view just loads as normal. Any help is greatly appreciated.

-Giles

Answer

Giles Van Gruisen picture Giles Van Gruisen · Jan 4, 2010

[UPDATE]

Fixed simply by using..

-(void)viewDidAppear:(BOOL)animated 
{

}

instead of

-(void)viewDidLoad
{

}

Thanks anyway!

/idiocy