问题描述
我的应用程序开头有一个登录页面,我不想在视图堆栈上。有没有办法在登录后加载我的第一个登录后视图而不使用 UINavigatorController
?
I have a login page at the beginning of my app that I do not want on the view stack. Is there a way to load my first post-login view after the login without using UINavigatorController
?
有更好的方法吗?我应该使用2 UINavigationControllers
吗?有没有办法为 UINavigationController
更改 RootViewController
?
Is there a better way to be doing this? Should I be using 2 UINavigationControllers
? Is there a way to change the RootViewController
for a UINavigationController
?
推荐答案
是的,您可以更改窗口的根控制器。将窗口的属性 rootViewController
设置为新控制器,您就完成了。不要忘记,第一个控制器(你要删除的一个)将不会收到 viewWillDisappear:
和 viewDidDisappear:
消息。如果您对控制器感兴趣,请在切换控制器之前自行发送。
Yes, you can change root controller of window. Set window's property rootViewController
to new controller and you're done. Don't forget though that first controller (one you are removing) will not receive viewWillDisappear:
and viewDidDisappear:
messages. Send them yourself before switching controllers if you're interested in them.
这篇关于有没有办法在不使用UINavigationController的情况下在iOS中更改视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!