Hi i have a page where i want to check if a user is already loggged in. Their log in details are stored as NSUserdefaults which i load in the viewdidload of the page
If the user is not logged in i would like to switch the xib to my login screen. Something is going wrong however. The checking of the login is working fine but my xib will nto chnage. I am using the same code as i always do for switching so im not sure if its because i am trying to do it in the viewdidload that is making it not work???
Code:
-(void)viewDidLoad
{
[super viewDidload];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *userid = [defaults objectForKey:@"userid"];
if([userid length] == 0)
{
// Go to login page
login_page *second = [[login_page alloc]initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
[second release];
}
else{
// User logged in already so load there details
}
}
Can anyone help me out?