【发布时间】:2020-12-17 05:33:59
【问题描述】:
我有两个导航控制器如下:
- 导航控制器1 -> 视图控制器1
- 选项卡视图控制器 -> 导航控制器 2 -> 视图控制器 2
当我在 View controller2 中并按下返回按钮时,我想转到 View controller1。使用导航栏中的内置后退按钮可以正常工作,但是当我尝试自己编写时它不起作用。
我尝试了以下语句,但没有奏效:
self.dismiss(animated: true, completion: nil)self.navigationController?.dismiss(animated: true, completion: nil)navigationController?.popViewController(animated: true)let story = UIStoryboard(name: "Main", bundle: nil)
let pushVC = story.instantiateViewControllerWithIdentifier("VC1")
let navigation = story.instantiateViewControllerWithIdentifier("Navigation1") as! UINavigationController
navigation.pushViewController(VC1!, animated: true)
【问题讨论】:
-
查看控制器 1 存在还是推送??
-
@HimanshuPatel 这是推送。
-
第一次 Navigation controller1 -> View controller1 go push to Navigation controller2 -> View controller2 对吧?然后 View controller2 -> View controller1 向右移动?
-
是的...我希望 View controller2 -> View controller1 发生