不多说了,直接上代码,看代码注释内容吧
| 代码如下 | 复制代码 |
| if respondsToSelector("UIAlertController"){ var refreshAlert = UIAlertController(title: "注意", message: "确定要删除该信息吗?", preferredStyle: UIAlertControllerStyle.Alert) refreshAlert.addAction(UIAlertAction(title: "是", style: .Default, handler: { (action: UIAlertAction!) in //实际代码 } )) refreshAlert.addAction(UIAlertAction(title: "否", style: .Default, handler: nil)) presentViewController(refreshAlert, animated: true, completion: nil) } else { let at = UIAlertView() at.delegate = self at.title = "注意" at.message = "确定要删除该信息吗?" at.addButtonWithTitle("是") at.addButtonWithTitle("否") at.show() } | |
上面的代码,ios8下直接用UIAlertController,ios7下用UIAlertView。ios8的处理函数直接写在上面了,而ios7的需要实现代理的一个函数:
| 代码如下 | 复制代码 |
| func alertView(View: UIAlertView!, clickedButtonAtIndex buttonIndex: Int){ switch buttonIndex{ case 0: //实际代码(选择是) break; case 1: //实际代码(选择否) break; default: //NSLog("Default"); break; //Some code here.. } } | |
自己在手机上测过,可用!
韩剧再婚皇后阿里云盘全集高清1080P资源链接-韩剧再婚皇后免费阿里云盘资源下载4K高清无删减版链接
poipiku网站如何打开-poipiku官网网页版访问入口
明日方舟:终末地-云游戏畅玩入口-明日方舟:终末地-网页版在线直连地址
poki在线小游戏网页版-poki免费游戏大全入口
poki游戏入口-点开即玩-poki游戏-在线免费畅玩
原神akt大佬资源viciNeko入口链接-原神akt大佬资源网页vicineko入口链接分享