我刚刚将Xcode更新到版本6.3(使用iOS SDK 8.3),而我的项目 - 在8.1和8.2上完美运行 - 似乎在presentViewController
方法中存在一些问题。
代码:
var alert = UIAlertController(title: "\(Percent)%", message: TipsMessage, preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler:nil))
self.presentViewController(alert, animated: true, completion: nil)
有人可以帮我吗?
答案 0 :(得分:1)
添加此alertController是超类....
lazy var alertController: UIAlertController = { [weak self] in
let alert = UIAlertController(title: "Alert", message: "This is a demo alert", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
return alert
}()
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.presentViewController(alertController, animated: true, completion: nil)
}