Я пытаюсь создать 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 КП я не в состоянии непосредственно перейти обратно к моему VC, если я выбираю «Выйти» – SwiftBeginner