简体   繁体   English

如何在Xcode中解散segue

[英]How to do unwind segue in Xcode

在此处输入图片说明

I have a tab bar controller and two destination views, one of which is a table view (static cells) and the other is a view controller. 我有一个标签栏控制器和两个目标视图,其中一个是表视图(静态单元格),另一个是视图控制器。 I can do a segue from one cell of the tableview to the yellow view controller but how can I do an unwind segue? 我可以从tableview的一个单元格到黄色视图控制器进行segue,但是如何进行放松segue? I know unwind segues require some code in the destination view controller but there are no destination view controllers in this case because the table view doesn't have a separate controller and neither does the tab bar controller 我知道解散序列在目标视图控制器中需要一些代码,但是在这种情况下没有目标视图控制器,因为表视图没有单独的控制器,选项卡栏控制器也没有

To implement Unwind Functionality, you have to firstly declare this function in your root view controller 要实现Unwind功能,您必须首先在根视图控制器中声明此功能

@IBAction func performUnwindSegue(segue: UIStoryboardSegue)

then right click Exit menu of your root view controller in storyboard, that unwind function could be visible. 然后在情节提要中右键单击根视图控制器的“ Exit菜单,可以看到展开功能。 Line it to your button in child view controller, then it should work. 将其插入子视图控制器中的按钮,然后它应该可以工作。

A simple example could be found here 一个简单的例子可以在这里找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM