joh*_*Doe 0 uinavigationcontroller ios swift
我有一个登录页面,如果登录成功,用户将被带到登陆viewController(VC).我有一个navigationController.我弹出登录VC并推入登陆VC.我遇到的问题是登录VC在堆栈中持续存在,如导航控制器上的左键所示,它会导航回登录页面.如何从堆栈中完全删除登录VC,以便导航控制器在用户登录后无法导航回用户?
self.navigationController?.popViewController(animated: true)
let landingPage = self.storyboard?.instantiateViewController(withIdentifier: "landingPage") as!
LandingViewController
self.navigationController?.pushViewController(landingPage, animated: true)
Run Code Online (Sandbox Code Playgroud)
您可以使用此setViewControllers方法设置堆栈,如下所示:
self.navigationController?.setViewControllers([landingPage], animated: true)
Run Code Online (Sandbox Code Playgroud)
您也不需要先弹出登录视图控制器.
| 归档时间: |
|
| 查看次数: |
1239 次 |
| 最近记录: |