【发布时间】:2019-02-21 17:52:23
【问题描述】:
我有 2 个故事板,在故事板 1 中我有一个登录页面,在故事板 2 中,我有我的主页!所以问题出在我的主页上,我有注销按钮,当用户按下按钮我想回到我的登录页面时,我已经尝试了一些对我不起作用的方法! 我试过了:
self.dismiss(animated: true, completion: nil)
还有:
for controller in self.navigationController!.viewControllers as Array { if controller.isKind(of: ViewController) { self.navigationController!.popToViewController(controller, animated: true) break } }
那么,有什么方法可以返回我的登录页面??
【问题讨论】:
-
您在登录页面上使用导航控制器吗?如何从登录页面推送主页面?
-
是的,我有!我使用 segue 进行推送,在我的主页中,我有另一个导航控制器 + 按钮选项卡控制器
-
从你的主页,试试
self.navigationController?.navigationController?.popToRootViewController(animated:true)
标签: ios swift uinavigationcontroller uistoryboard