我想创建一个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