通常、UIAlertControllerのbuttonをタップして、Actionが実行されるとUIAlertViewは消えます。
これを、Actionによってはタップしても消えないようにしたいです。どうしたらいいでしょうか?
swift
1let alert: UIAlertController = UIAlertController(title: "タイトル", message: "メッセージ", preferredStyle: UIAlertControllerStyle.Alert) 2 3let defaultAction: UIAlertAction = UIAlertAction(title: "アラートを消さない", style: UIAlertActionStyle.Default, handler:{ 4 (action: UIAlertAction!) -> Void in 5 // タップしてもアラートを消さない 6}) 7 8let cancelAction: UIAlertAction = UIAlertAction(title: "アラートを消す", style: UIAlertActionStyle.Cancel, handler:{ 9 (action: UIAlertAction!) -> Void in 10}) 11 12alert.addAction(cancelAction) 13alert.addAction(defaultAction) 14 15presentViewController(alert, animated: true, completion: nil)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。