UIAlertControllerが警告を画面に正しく表示していますが、xCodeシミュレータでokを押すとアラートを残さないようにします。 UIAlertActionStyle.CancelUIAlertController addActionが動作しない
func displayAlertMessage(userMessage:String) {
let myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert);
let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Cancel, handler: nil);
myAlert.addAction(okAction);
self.presentViewController(myAlert, animated: true, completion: nil);
}
func displayAlertMessage(userMessage:String) {
let myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertControllerStyle.Alert);
let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil);
myAlert.addAction(okAction);
self.presentViewController(myAlert, animated: true, completion: nil);
}
に何かをしたい場合は、displayAlertMessageはメインスレッドから呼び出されることを、よろしいですか? – dimpiax
はい私は正しい文字列がユーザメッセージに入力されているためです。 –
ちょうどメモ;外部画像にリンクするのではなく、質問に画像を埋め込むことが望ましい(投稿を作成/編集するときに画像ボタンがある)。 –