我有兩個視圖控制器。按下按鈕以使用下面的代碼,我已從一個視圖導航到另一個視圖。如何檢查視圖控制器是否被添加到堆棧中
*let secondViewController = self.storyboard!.instantiateViewControllerWithIdentifier("NotificationController") as! NotificationController
self.navigationController!.pushViewController(secondViewController, animated: true)*
對於後面,我使用欄按鈕上的酒吧按鈕點擊後退使用下面的代碼。
self.navigationController?.popViewControllerAnimated(true)
所以我的問題是,如果我從一個視圖到另一個視圖不斷地添加到堆棧中。我只想顯示另一個視圖,當它已經添加到堆棧停止添加它時,它只會增加一次。
HTTP://計算器。com/a/42523549/5461400試試這個 –