objective c - UINavigationController flow for login ios -
solved:
once user has logged in / signed up, use following code transition main storyboard...
uiwindow* window = [[uiapplication sharedapplication] keywindow]; window.rootviewcontroller = [[uistoryboard storyboardwithname:@"main" bundle:[nsbundle mainbundle]] instantiateinitialviewcontroller];
i have following uinavigationcontroller flow handle logging in...the top segue after tabbarcontroller goes uinavigationcontroller root viewcontroller.
when user logged in "this segue works" executed user doesn't have log in @ login screen. works perfectly. issue run when user has login...the segue login/signup screen login screen works perfectly, when go login screen tabbar following happens:
this shouldn't happen because have following code in viewcontroller.m (gotten here called)
- (void)viewdidload { ... self.navigationitem.title = @"messages"; self.navigationitem.hidesbackbutton = yes; nslog(@"gotten here"); ... }
does know why happening?
i keep login flow separate normal app flow. means don't link segue login screen app, handle in appdelegate:
if ([myuserhandler sharedhelper].isauthenticated) { [self presentmaininterface]; } else { [self presentwelcomeinterface]; }
where first method this:
- (void)presentmaininterface { self.window.rootviewcontroller = [[uistoryboard storyboardwithname:@"main" bundle:[nsbundle mainbundle]] instantiateinitialviewcontroller]; }
and other presents login screen:
- (void)presentwelcomeinterface { uiviewcontroller* rootcontroller = [[uistoryboard storyboardwithname:@"main" bundle:[nsbundle mainbundle]] instantiateviewcontrollerwithidentifier:@"loginscreen"]; uinavigationcontroller* navigation = [[uinavigationcontroller alloc] initwithrootviewcontroller:rootcontroller]; self.window.rootviewcontroller = navigation; }
this way login screen loaded when user not authenticated.
Comments
Post a Comment