Ios/swift/AlertView
提供: 初心者エンジニアの簡易メモ
エラーメッセージ
let alert = UIAlertView(title: "エラー", message: "エラーです", delegate: self, cancelButtonTitle: "OK") alert.show()
確認メッセージ
let ac = UIAlertController(title: "Title", message: "Message", preferredStyle: .Alert) let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel) { (action) -> Void in print("Cancel button tapped.") } let okAction = UIAlertAction(title: "OK", style: .Default) { (action) -> Void in print("OK button tapped.") } ac.addAction(cancelAction) ac.addAction(okAction) presentViewController(ac, animated: true, completion: nil)