前端之家收集整理的这篇文章主要介绍了
UIAlertController在Swift中的用法,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
let alert:UIAlertController = UIAlertController(title: "message",message: "Thank you clicking",preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "close AlertView",style: UIAlertActionStyle.Default,handler: nil))
alert.addAction(UIAlertAction(title: "change color",handler:{alertAction in
UIView.animateWithDuration(2.5,animations: {self.headerView.backgroundColor = UIColor.brownColor()},completion: {_ in
print("animate close")
})
}))
self.presentViewController(alert,animated:true,completion:nil)