UINavigationController thread for ios login

It is decided:

Once the user is logged in / registered, use the following code to go to the main storyboard ...

UIWindow* window = [[UIApplication sharedApplication] keyWindow]; window.rootViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateInitialViewController]; 

I have the following UINavigationController thread that handles login ... the top segment after the tabbarcontroller goes to the uinavigation controller, which is the root for the view manager.

enter image description here

When the user has already logged in, โ€œthis segue executionโ€ is performed, so the user does not need to log in on the login screen. This works great. The problem I am facing is when the user needs to log in ... segue from the login / registration screen to the login screen works fine, but when I go from the login screen to the panel, the following happens:

enter image description here

This really should not happen, because I have the following code in my view.m dispatcher (it turned out that is being called here)

 - (void)viewDidLoad { ... self.navigationItem.title = @"Messages"; self.navigationItem.hidesBackButton = YES; NSLog(@"gotten to here"); ... } 

Does anyone know why this is happening?

+1
source share
2 answers

I like to keep my input stream separate from the normal application stream. This means that I do not bind segue from the application login screen, but I process this in my AppDelegate:

 if ([MyUserHandler sharedHelper].isAuthenticated) { [self presentMainInterface]; } else { [self presentWelcomeInterface]; } 

Where the first method does this:

 - (void)presentMainInterface { self.window.rootViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateInitialViewController]; } 

and the other is the login screen:

 - (void)presentWelcomeInterface { UIViewController* rootController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"loginScreen"]; UINavigationController* navigation = [[UINavigationController alloc] initWithRootViewController:rootController]; self.window.rootViewController = navigation; } 

Thus, the login screen is loaded only when the user is not authenticated.

+5
source

Create your own UITabBarControler class (subclass) and assign this custom class to your storyboard in the storyboard. Then in viewDidLoad of custom tabbar controller add your code

 self.navigationItem.hidesBackButton = YES; 

It will work fine.

enter image description here

0
source

All Articles