簡體   English   中英

Xcode Swift執行帶有警告的Segue

[英]Xcode Swift perform segue with alert

我有三個ViewController。 當您單擊顯示的警報的“ Ok按鈕時,我想執行從ThirdViewControllerSecondViewController 我已經嘗試使用此代碼:

alert.addAction(UIAlertAction(title: "Ok!", style: UIAlertActionStyle.default, handler: { action -> Void in
     self.performSegue(withIdentifier: "ThirdViewControllerSegueBack", sender: self)
}))

問題是,在新窗口SecondViewController顯示出來,所以當我點擊back導航欄上它使我回ThirdViewController 我希望它顯示FirstViewController

在SecondViewController中,您必須創建Unwind segue

@IBAction func unwindToController2(segue:UIStoryboardSegue) { } 

ViewController3中的故事板上的鼠標從ViewController拖動以退出Button並添加segue。 向其添加標識符,然后調用UIAlertController 在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM