Xcode - 注销按钮
显然,我有一个 LoginViewController
和一个 StartUpController
。
LoginViewController
具有验证用户身份和注册新用户的功能 (presentModalViewController
)。用户登录后,我的系统将显示StartUpController
。
在这个 StartUpController 中,我拥有 TabBarController、NavigationController 等所有内容。这个 StartUpController 实际上处理 5 个不同的视图。
我的问题是:当我的用户从我的视图之一单击“注销”按钮时,我应该怎么做才能删除我的所有视图?
我想再次显示我的 LoginViewController.. 但同时删除 StartUpController 视图及其所有视图。
请教我如何做到这一点:
Apparently, I have one LoginViewController
and a StartUpController
.
LoginViewController
has functionality to authenticate user and register new user (presentModalViewController
). Once the user has logged in, my system will displayStartUpController
.
Inside this StartUpController
, I have everything such as TabBarController, NavigationController, etc. This StartUpController
is actually handling 5 different views.
My question is: what should I do to remove all of my views when my user click on "LogOut" button from one of my view?
I want to show my LoginViewController again.. but at the same time, remove the StartUpController view and all its views.
Please teach me how to do this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的身份验证视图是根视图控制器的视图,请使用
-popToRootViewControllerAnimated:
导航控制器参考上的方法,例如:假设您没有对视图控制器所有权做任何奇怪的事情,导航控制器将释放子视图控制器(反过来,子视图控制器应该释放它们的视图和其他属性)。
If your authentication view is your root view controller's view, use the
-popToRootViewControllerAnimated:
method on your navigation controller reference, e.g.:Assuming you're not doing any weirdness with view controller ownership, the navigation controller will release the children view controllers (which, in turn, should release their views and other properties).