迅速。如何修改导航堆栈以显示队列中的另一个视图控制器

时间:2016-09-21 10:13:10

标签: swift uinavigationcontroller

我有导航堆栈,我有下一个视图控制器

navigation controller -> dashboard view controller -> settings view controller

在设置屏幕上我想更改一些设置,当我回去时我需要显示其他视图控制器。导航堆栈将如下所示

navigation controller -> maintenance view controller

如何以正确的方式做到这一点,我想到的一种方式是替换导航堆栈。但也许有一些更好的解决方案。

1 个答案:

答案 0 :(得分:0)

通常我会弹出root,然后按下新控制器

因此在设置视图控制器时,保存后的新设置可以尝试下面的

self.navigationController?.popToRootViewControllerAnimated(true)

let maintenanceVC = self.storyboard?.instantiateViewControllerWithIdentifier("MaintenanceId")
self.navigationController?.pushViewController(maintenanceVC!, animated: false)

确保使用动态为popToRootViewControllerAnimated

true