[英]Unwind segue doesn't work in Swift 3 and iOS 10
I'm trying to test unwind segue in iOS 10 and Swift 3. 我正在尝试在iOS 10和Swift 3中测试unwind segue。
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: 我在
TableViewController
类中添加了segue的代码,并在表视图控制器场景中连接“取消”按钮和退出:
@IBAction func unwindToRootViewController(segue: UIStoryboardSegue) {
print("Unwind to Root View Controller")
}
but my simple segue doesn't work. 但我的简单segue不起作用。 What am I doing wrong?
我究竟做错了什么?
As can be seen in the comments above the problem was this: 从上面的评论中可以看出问题是这样的:
I add code for segue in TableViewController class
我在TableViewController类中添加了segue的代码
The unwind segue has to be in your "outer" ViewController
, not the TableViewController
. 展开segue必须位于“外部”
ViewController
,而不是TableViewController
。
This article gives a very nice introduction to unwind segues. 本文对展开segues进行了非常好的介绍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.