I encountered a crash while testing my app. The following image is my storyboard:
I have the code in View Controller:
@IBAction func unwindToHomeScreen(segue:UIStoryboardSegue) {
}
The view of "Add new Item" have a "Cancel" button, I controlled-drag it to the "Exit" icon at the top and link to unwindToHomeScreen
, it works fine.
The "Add new Item" has a class AddTableViewController
and the code I wrote inside:
@IBAction func save() {
// Execute the unwind segue and go back to the home screen
performSegueWithIdentifier("unwindToHomeScreen", sender: self)
}
I controlled-drag the "Save" button to the func, but the app crash when I click the button
I can use dismissViewControllerAnimated(true, completion: nil)
instead, but I just wonder why performSegueWithIdentifier
can't work?
I read the code at dropbox.com/s/hpybgg9x67rtqng/foodpinstatictable.zip?dl=0 and try to make one and using performSegueWithIdentifier
like this example for practicing, I didn't see the segue identifier at her, what is the difference?