2016-06-29 55 views
1

我試圖與報警控制器來顯示一個消息,我的用戶,但它不會顯示UIAlertController沒有顯示

let alert = UIAlertController(title: "Error", message: "Incorrect username/password", preferredStyle: UIAlertControllerStyle.Alert) 
     alert.addAction(UIAlertAction(title: "okay", style: UIAlertActionStyle.Default, handler: nil)) 

回答

4

您好像沒有出現呢。將此代碼粘貼到要顯示警報的地方

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

完美地工作!感謝你及時的答覆! – MichaelQ