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的弹框
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- BrickBatView 可通过组件化的形式配置视图的每行元素, 支持扩展, 它类似砌墙, 每个砖块都可以自定义,...
- iOS系统弹框的title和message的颜色为黑色,确定,取消的文字颜色有蓝色(Default)和红色(Des...