xcode 有没有办法在不使用 UINavigationController 的情况下更改 iOS 中的视图?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5279313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:27:19  来源:igfitidea点击:

Is there a way to change Views in iOS without using UINavigationController?

objective-cxcodeiosipaduinavigationcontroller

提问by Tony Lukasavage

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?

我的应用程序开头有一个登录页面,我不想在视图堆栈中显示该页面。有没有办法在登录后加载我的第一个登录后视图而不使用UINavigatorController

Is there a better way to be doing this? Should I be using 2 UINavigationControllers? Is there a way to change the RootViewControllerfor a UINavigationController?

有没有更好的方法来做到这一点?我应该使用 2UINavigationControllers吗?有没有办法改变RootViewControllera UINavigationController

回答by hoha

Yes, you can change root controller of window. Set window's property rootViewControllerto 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.

是的,您可以更改窗口的根控制器。将窗口的属性设置rootViewController为新控制器,您就完成了。不要忘记尽管第一个控制器(您要删除的控制器)不会收到viewWillDisappear:viewDidDisappear:消息。如果您对它们感兴趣,请在切换控制器之前自己发送它们。

回答by aceofspades