我想使用push segue来编辑"条目"否则通过当前模态segue添加。按取消时,它不会使用正常的dismissViewControllerAnimated方法解除。因此,我不得不同时组合popViewControllerAnimated方法,因此根据他们在编辑条目时是单击取消还是添加它,它会尝试两者。
两者都是通过NSNotifcation完成的,因为我需要从最后一个viewcontroller返回到第一个对象:
func cancel(notification: NSNotification){
println("Cancel Executed")
let userInfo:Dictionary<String,EntryItem!> = notification.userInfo as Dictionary<String,EntryItem!>
entry = userInfo["Object"]
tableView.reloadData()
self.navigationController?.popViewControllerAnimated(true)
dismissViewControllerAnimated(true, completion: nil)
dataModel.saveEntries()
}
这个问题是,如果我通过segues到达第三个视图控制器(以5为一个字符串),我取消,然后返回到条目屏幕,但是看起来混乱的导航栏需要应该在那里的地方。也没有标题显示。它有一个取消按钮,如果按下它会导致崩溃。
这是它应该是什么样子:
这是popViewControllerAnimated对它的作用。