保存数据并在swift中放松到另一个控制器

时间:2015-04-06 21:38:14

标签: ios swift segue

我想制作保存数据的按钮并放松到另一个控制器(UITableViewController)。我的按钮成功保存数据,但我不能放松到另一个控制器。

我的按钮

@IBAction func buttonDone(sender: UIBarButtonItem) {
    saveText() // it is a function of save data
    [back]
}

功能

 override func prepareForSegue(segue: (UIStoryboardSegue!), sender: AnyObject!) {
    if (segue.identifier == "first") {
        // pass data to next view
    var backToFirst = segue.destinationViewController as FirstTableViewController
    }
}

我下一步

let back = prepareForSegue

2 个答案:

答案 0 :(得分:0)

假设它在导航控制器中只需调用

self.navigationController!.popViewControllerAnimated(true)

答案 1 :(得分:0)

要执行展开segue,必须从您要展开的视图控制器中调用performSegueWithIdentifier("myUnwindSegueID")

您还需要确保在IB中设置了展开segue。如果您没有http://spin.atomicobject.com/2014/10/25/ios-unwind-segues/

,请查看此内容