Unwind Segue在Swift 3和iOS 10中不起作用 [英] Unwind segue doesn't work in Swift 3 and iOS 10

查看:80
本文介绍了Unwind Segue在Swift 3和iOS 10中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在iOS 10和Swift 3中测试放松测试.

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

我制作了一个简单的应用程序,如下所示:

I made a simple app like this:

我在TableViewController类中添加了segue的代码,并连接取消"按钮并在Table View Controller场景上退出:

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")
}

但是我简单的segue不起作用.我在做什么错了?

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

推荐答案

从上面的注释中可以看出,问题是这样的:

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

我在TableViewController类中为segue添加代码

I add code for segue in TableViewController class

放开序幕必须在您的外部" ViewController中,而不是在TableViewController中.

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

这篇文章提供了一个非常好的放松介绍塞格斯.

This article gives a very nice introduction to unwind segues.

这篇关于Unwind Segue在Swift 3和iOS 10中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆