LoginSignup
0
1

More than 5 years have passed since last update.

UIAlertController メモ

Last updated at Posted at 2017-06-09

UIAlertController生成

let alert = UIAlertController(title: "アラートのタイトル", message: "アラートのメッセージ", preferredStyle: UIAlertControllerStyle.alert)

アラートにテキスト入力フォームを追加

alert.addTextField(configurationHandler: nil)

アラートにボタンを追加

let okButton = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: { (action: UIAlertAction!) in
    //ボタンを押した時の処理
})
alert.addAction(okButton)

アラートを閉じるキャンセルボタン

let cancelButton = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: nil)
alert.addAction(cancelButton)

アラートを表示

self.present(alert, animated: true, completion: nil)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1