我正在尝试在应用首次加载时添加 UIAlertView 或 Controller。目前,我的viewDidLoad
方法中有这段代码。
let welcomeAlert = UIAlertController(title: "hola", message: "this is a test.", preferredStyle: UIAlertControllerStyle.Alert)
welcomeAlert.addAction(UIAlertAction(title: "ok.", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(welcomeAlert, animated: true, completion: nil)
为什么不显示警报视图?我使用了相同的代码,但在IBAction
按钮内部,它按预期工作。