UIView Login screen to tabbar logic

Posted by Benjamin De Bos on Stack Overflow See other posts from Stack Overflow or by Benjamin De Bos
Published on 2012-12-17T17:01:34Z Indexed on 2012/12/17 17:02 UTC
Read the original article Hit count: 306

Filed under:
|
|

Folks,

i'm having trouble with some navigation logic. Currently i have a simple two tabbed tabbar application. But i want to show a loginscreen in front. So that would be an UIView.

Currently the code is as follows:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *viewController1 = [[roosterViewController alloc] initWithNibName:@"roosterViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = @[viewController1, viewController2];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;

}

SO this pushes a simple tabcontroller. Well, now i want to have a login screen. So that would be a simple UIView which pushes the tabbar controller. But i can't seem to see the logic on how to do this.

I've been trying to present a modal view controller, but the thing is: the tabbar will be loaded on the background. Since i need the username/password information to work on the tabbarview, this won't work.

My Logic would be:

delegate > load loginViewController > load tabbar controller

But, then i need to be able to "logout". So i need to destroy the tabbar controller and present the login screen.

Any thoughts on this?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios