これはアラートのコードです。問題は、ユーザーが「はい」を意味するボタン「Ja」を押したときに別のVCにセグをしたいということです。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ようこそメイト:) –