Hi All I'm new to iOS development and am currently having an issue with something, I'm trying to make a login form appear modally if a user is not logged in.
I'm using NSUserDefaults to store an id which I'm simply checking if it exists. If it doesnt then I would want the UIViewController to appear.
So far I have the following code in my UINavigationController which is within a UITabViewController , I'm trying to get the UIViewController to appear above the First UINavigationController (the one that is selected), at the moment the animation is happening but there is only a black screen even though the Login screen has all the relevant text boxes etc already created. If I set this Login screen as the initial view to load, it loads up fine.
This is the code that appears in the First viewcontroller of the UINavigationController.
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
if (![prefs stringForKey:@"id"]){
LoginViewController *loginController = [[LoginViewController alloc] init];
[self presentModalViewController:loginController animated:YES];
} else {
[self loadCoffeeUserOrders:[prefs stringForKey:@"id"]];
}
the modal view is loading up but at the moment it just appears black, I've tried creating a new Login Screen and the same thing happens: nothing but a black screen.
hope there is enough information there for someone to understand what might be going on, I am very new to iOS development so if I've made some mistakes it would be nice to know where I'm going wrong.
thanks