let alertController = UIAlertController(title: "系统提示", message: "您确定要离开吗", preferredStyle: UIAlertControllerStyle.alert)
let cancelAction = UIAlertAction(title: "取消", style: UIAlertActionStyle.cancel, handler: nil )
let okAction = UIAlertAction(title: "确定", style: UIAlertActionStyle.default) { (ACTION) in
print("确定")
}
alertController.addAction(cancelAction);
alertController.addAction(okAction);
self.present(alertController, animated: true, completion: nil)
let alertController = UIAlertController(title: "系统提示", message: "您确定要删除吗", preferredStyle: .actionSheet)
let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
let deleteAction = UIAlertAction(title: "删除", style: .destructive, handler: nil)
let archiveAction = UIAlertAction(title: "保存", style: .default, handler: nil)
alertController.addAction(cancelAction)
alertController.addAction(deleteAction)
alertController.addAction(archiveAction)
self.present(alertController, animated: true, completion: nil)
Swift的弹框
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- BrickBatView 可通过组件化的形式配置视图的每行元素, 支持扩展, 它类似砌墙, 每个砖块都可以自定义,...
- iOS系统弹框的title和message的颜色为黑色,确定,取消的文字颜色有蓝色(Default)和红色(Des...