我正在尝试使用 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/