我想創建一個UIAlertController
有兩個選項'取消'和'註銷'。我想要'取消'按鈕來取消警報和'註銷'按鈕來執行與它相關的繼續,這是我在故事板中設置的。UIAlertController - 過渡到另一個賽格
我的代碼是;
class HomeVC: UIViewController {
@IBAction func SignOutBtn(sender: UIButton) {
let alertController = UIAlertController(title: "Alert",
message: "Are you sure you want to log out?",
preferredStyle: .Alert)
let cancelAction = UIAlertAction(title:"Cancel",
style: .Cancel) { (action) -> Void in
print("You selected the Cancel action.")
}
let submitAction = UIAlertAction(title:"Log out",
style: .Default) { (action) -> Void in
print("You selected the submit action.")
self.presentedViewController
}
alertController.addAction(submitAction)
alertController.addAction(cancelAction)
self.presentViewController(alertController, animated: true, completion: nil)
}
}
那麼,什麼是問題... –
@Rohit KP我無法Segue公司回到我的VC,如果我選擇 「退出」 – SwiftBeginner