I have an ios5 app developed using storyboards that currently displays a tab bar controller view on initial launch. I would like to display a login screen before the tab bar controller is displayed. The user would enter his username & password, the system would then authenticate the user and then if successful, display the tab bar controller.
I have tried the following 3 options with no luck.. any ideas ?
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Option 1
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
PointsViewController *firstVC = [[tabBarController viewControllers] objectAtIndex:0];
UIViewController *loginViewController = [[LoginViewController alloc] init];
[firstVC.navigationController pushViewController:loginViewController animated:YES];
// Option 2
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UIViewController *loginViewController = [[LoginViewController alloc] init];
[tabBarController presentViewController:loginViewController animated:NO completion:nil];
// Option 3
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UIViewController *loginViewController = [[LoginViewController alloc] init];
[tabBarController presentModalViewController:loginViewController animated:NO];
return YES;
}