我正在研究苹果制作iOS应用程序的入门指南。 当我点击NewCaptureVewController中的保存按钮时,我现在正试图解开segue:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if saveButton === sender {
...
capture = Capture(photo: photo, name: name, notes: notes)
}
从CapturesTableViewController执行此代码之后:
@IBAction func unwindToMealList(sender: UIStoryboardSegue) {
if let sourceViewController = sender.sourceViewController as? NewCaptureViewController, capture = sourceViewController.capture{
// Add a new meal.
let newIndexPath = NSIndexPath(forRow: captures.count, inSection: 0)
captures.append(capture)
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Bottom)
}
}
但if语句永远不会执行。
我在各种检查员检查过,但我没有发现任何错误。 你有一些提示来发现问题是什么吗?