Unwind segue doesn't work in Swift 3 and iOS 10

不打扰是莪最后的温柔 提交于 2019-11-30 23:51:37

问题


I'm trying to test unwind segue in iOS 10 and Swift 3.

I made a simple app like this:

I add code for segue in TableViewController class and connect "Cancel" button and Exit on Table View Controller Scene:

@IBAction func unwindToRootViewController(segue: UIStoryboardSegue) {
    print("Unwind to Root View Controller")
}

but my simple segue doesn't work. What am I doing wrong?


回答1:


As can be seen in the comments above the problem was this:

I add code for segue in TableViewController class

The unwind segue has to be in your "outer" ViewController, not the TableViewController.

This article gives a very nice introduction to unwind segues.



来源:https://stackoverflow.com/questions/39915867/unwind-segue-doesnt-work-in-swift-3-and-ios-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!