Это код предупреждения. Проблема в том, что я хочу переходить на другой VC, когда пользователь нажимает кнопку «Ja», что означает «Да» на английском языке.Как переходить с помощью AlertView?
@IBAction func TillbakaAction(_ sender: UIButton)
{
createAlert(title: "Är du säker på att du vill börja om?", message: "Ifyllda betyg nollställs")
}
func createAlert (title:String, message:String)
{
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
//CREATING ON BUTTON
alert.addAction(UIAlertAction(title: "Ja", style: UIAlertActionStyle.default, handler: { (action) in
alert.dismiss(animated: true, completion: nil)
print ("Jag vill gå tillbaka")
}))
alert.addAction(UIAlertAction(title: "Nej", style: UIAlertActionStyle.default, handler: { (action) in
alert.dismiss(animated: true, completion: nil)
print("Nej, jag vill inte gå tillbaka")
}))
self.present(alert, animated: true, completion: nil)
Что бы я сделал без вас. Спасибо – theswed
@theswed Приветственный помощник :) –