Search code examples
iphoneobjective-cviewdidload

presentModalViewController in viewDidLoad on first launch


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


Solution

  • [UPDATE]

    Fixed simply by using..

    -(void)viewDidAppear:(BOOL)animated 
    {
    
    }
    

    instead of

    -(void)viewDidLoad
    {
    
    }
    

    Thanks anyway!

    /idiocy