Swift 3 - 更新后如何添加导航 Controller 按钮(如返回) - 刷新并重新加载我的 View Controller

标签 swift uiviewcontroller uinavigationcontroller

我正在尝试使用 UIApplication.shared.keyWindow?.rootViewController 刷新我的 viewcontroller(重新加载它),如下面的代码所示,但是当重新加载时 novaigation Controller 不存在,我的意思是有一个可以转到上一个 View Controller 的后退按钮,当我这样做时它没有出现 - 任何帮助

@IBAction func Save(_ sender: AnyObject) {
 UIApplication.shared.keyWindow?.rootViewController = storyboard!.instantiateViewController(withIdentifier: "UploadPhotoviewcontroller")
        }

最佳答案

默认后退按钮、外观和在当前 navigationController 导航堆栈中的工作。如果您更改 rootViewController,此操作将破坏您当前的导航堆栈和所有以前的 Controller 。而且你不能回去。

更改 rootViewController 是不好的做法。我认为你的架构有问题

关于Swift 3 - 更新后如何添加导航 Controller 按钮(如返回) - 刷新并重新加载我的 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41602878/

相关文章:

ios - 将流式 (utf8) 数据转换为字符串的安全方法是什么?

ios - 如何在 Swift 中更改结构中的变量存储属性?

ios - 半透明的 UINavigationBar

ios - navigationController popToViewController 无法在 swift 3 中工作

swift - Rx 中 override 的替代品是什么?

ios - 适用于 iOS 的 Firebase ML 套件 : "Unable to convert data to a string using the detected encoding" error when using local model

ios - 多个 segues 到一个 UIViewController

iphone - 如何将通用(NSObject) Controller 与 UIViewController 的 subview 一起使用?

iphone - UINavigationController 强制旋转

ios - 主细节 uisplitViewController 和 UINavigationController View