UIAlertController uyarıyı ekranda doğru şekilde görüntülüyor, ancak xCode simülatöründe OK tuşuna basmak hiçbir şey yapmıyor ve uyarıyı bırakmıyor. UIAlertActionStyle.CancelUIAlertController addAction çalışmıyor
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);
}
Emin misiniz şey, ana iş parçacığı çağrılan bu displayAlertMessage yapmak istiyorsanız? – dimpiax
Evet, çünkü kullanıcı mesajına doğru dize giriliyor. –
Sadece bir not; Dış bir resme bağlanmak yerine, sorunuzu resminize yerleştirmek tercih edilebilir (bir gönderi oluştururken/düzenlerken bir resim düğmesi vardır). –