简体   繁体   English

使用Swift 2在Xcode 7中展开无法正常工作

[英]Unwind in Xcode 7 Using Swift 2 Does not Work

I have two View Controllers. 我有两个视图控制器。 In the second View Controller, I have a button called "Gidelim". 在第二个View Controller中,我有一个名为“ Gidelim”的按钮。 I want it to turn back to the first View Controller when I click on it. 当我单击它时,我希望它回到第一个View Controller。

For this purpose, I have defined a func in the first View Controller's as below: 为此,我在第一个View Controller中定义了一个func,如下所示:

The Unwind Segue 放荡的塞古

The func "YeniVCAc" shows the second View Controller and it works. 函数“ YeniVCAc”显示了第二个View Controller,并且可以正常工作。 The func "ilkVCGit" has to return back to this View Controller. 函数“ ilkVCGit”必须返回到该视图控制器。

I have CTRL-dragged the button to the Exit on the second view controller. 我已经在第二个视图控制器上将CTRL的按钮拖动到了Exit。 Then I have chosen ilkVCGit. 然后,我选择了ilkVCGit。

This design must be correct as I think. 我认为这种设计必须正确。 However, the application crashes when I press the button on the second view controller. 但是,当我按下第二个视图控制器上的按钮时,应用程序崩溃。

Connect your button in the Interface Builder to this Action, in the class of your SecondViewController: 在SecondViewController的类中,将Interface Builder中的按钮连接到此Action:

@IBAction func dismiss(sender: AnyObject) {
    self.dismissViewControllerAnimated(true, completion: nil)
}

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

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