如何手动设置要在应用委托中显示的故事板视图 [英] How to manually set which storyboard view to show in app delegate

查看:109
本文介绍了如何手动设置要在应用委托中显示的故事板视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序想要在应用程序处于非活动状态一段时间后注销用户。这是应用程序中的多个不同视图,我希望应用程序委托在此方法触发时将loginview设置为当前视图:

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

如何手动将loginViewController设置为当前显示的视图这个方法中的故事板?

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

推荐答案

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                             bundle: nil];
LoginViewController *loginViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
[_window setRootViewController:loginViewController];

这篇关于如何手动设置要在应用委托中显示的故事板视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆