在ios中,當AViewController啓動另一個ViewContoller(BViewController)時,AViewController的prepareForSegue()將獲得調用,並且「segue.destinationViewController」將成爲對BViewController的引用。如何獲得通知當ViewController返回到我原來的ViewController
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
segue.destinationViewController
}
我的問題是,如果BViewController「返回」到AViewController,這AViewController的方法將得到調用,並AViewController知道它來自BViewController?
謝謝。我已閱讀此線程有關使用unwind segue http://stackoverflow.com/questions/12561735/what-are-unwind-segues-for-and-how-do-you-use-them。我在xcode 6中使用Storyboard,我無法將segue從源視圖拖到退出按鈕。我從我的導航控制器 – hap497 2014-09-21 16:21:39
@ hap497的導航欄中的「返回」按鈕返回,因爲它具有特定功能,所以無法使用標準後退按鈕來執行此操作;您必須創建您自己的左欄按鈕項目,然後將其拖至退出圖標。如果你想使用後退按鈕,你必須使用你在B的viewDidDisappear方法中調用的委託方法告訴A,它(B)正在讓你回到屏幕上。 – rdelmar 2014-09-21 17:16:30