标签:
introduced=2.0, deprecated=9.0 ios9已经废弃 建议使用UIAlertController
创建AlertView
let alertView = UIAlertView() alertView.title = "温馨提示" alertView.message = "UIAlertView已经废弃,不要再执着了" alertView.addButtonWithTitle("取消") alertView.addButtonWithTitle("确定") alertView.cancelButtonIndex = 0 alertView.delegate = self alertView.show()
执行代理 : 先添加代理UIAlertViewDelegate
func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) { if buttonIndex == alertView.cancelButtonIndex{ print("取消了") }else{ print("骚年,放弃吧") } }
标签:
原文地址:http://www.cnblogs.com/spaceID/p/4977021.html