我正在尝试使用 Swift 2.3 导航到 UIViewController
。更准确地说,我正在尝试重新加载当前处于事件状态的 UIViewController
。我不知道用户当前激活了哪个 View ,因此必须动态定义。
我尝试了几种方法,但它们都会导致编译或运行时错误。
这样的事情可能吗?
let activeViewIdentifier = ??? // Get currently active view identifier as a string
self.performSegueWithIdentifier(activeViewIdentifier, sender:self)
最佳答案
你可以这样:
objective-C :
self.navigationController.topViewController.restorationIdentifier
swift :
self.navigationController?.topViewController?.restorationIdentifier
关于ios - 在 Swift 2.3 中导航到 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40741777/