Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually set which storyboard view to show in app delegate

I have an app that wants to log out user whenever application is inactive for a set period of time. It's multiple different views in the app, and i want the app delegate to set loginview as current view whenever this method fires:

- (void)applicationDidBecomeActive:(UIApplication *)application

How to manually set loginViewController as current showing view in the storyboard in this method?

like image 584
bogen Avatar asked Dec 11 '22 15:12

bogen


1 Answers

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                             bundle: nil];
LoginViewController *loginViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
[_window setRootViewController:loginViewController];
like image 172
bogen Avatar answered Jan 29 '23 14:01

bogen