uisplitviewcontroller - iOS switch rootViewController not working -
i have login view checks see if there default settings, syncs data. if there no default settings, view waits user login. if there settings , data syncs correctly, should switch split view.
the code works if user enters login information. syncs data, switches view. if user logged in, hits function , doesnt switch view.
here code being called both paths:
-(void)redirect{ nslog(@"redirect@"); uisplitviewcontroller *split = [self.storyboard instantiateviewcontrollerwithidentifier:@"orders_split"]; [self.view.window setrootviewcontroller:split]; }
"redirect@" shows in log on initial load if user has logged in once. have confirmed there no sync errors, hits function not perform switch.
i moving standard view nav controller splitview, cannot use manual segue trigger.
try use app delegate:
uisplitviewcontroller *split = [self.storyboard instantiateviewcontrollerwithidentifier:@"orders_split"]; myappdelegate *appdelegate = (myappdelegate *)[[uiapplication sharedapplication] delegate]; appdelegate.window.rootviewcontroller = split;
in projects animation:
+(void)setrootcontroller:(uiviewcontroller*)controller storyboard:(uistoryboard*)storyboard{ myappdelegate *appdelegate = (myappdelegate *)[[uiapplication sharedapplication] delegate]; [uiview transitionwithview:appdelegate.window duration:0.5 options:uiviewanimationoptiontransitioncrossdissolve animations:^(void) { bool oldstate = [uiview areanimationsenabled]; [uiview setanimationsenabled:no]; appdelegate.window.rootviewcontroller = controller; [uiview setanimationsenabled:oldstate]; } completion:nil]; }
Comments
Post a Comment