swift – 如何在UIAlertController中更改一个UIAlertAction文本
发布时间:2020-12-14 04:35:39 所属栏目:百科 来源:网络整理
导读:如何在UIAlertController中更改一个UIAlertAction的文本颜色,而不是所有操作按钮. 这是我的UIAlertController代码:我想将Delete UIAlertAction文本颜色更改为红色. //Alert to select more methodfunc moreAlert(){ let optionMenu = UIAlertController(tit
如何在UIAlertController中更改一个UIAlertAction的文本颜色,而不是所有操作按钮.
这是我的UIAlertController代码:我想将Delete UIAlertAction文本颜色更改为红色. //Alert to select more method func moreAlert() { let optionMenu = UIAlertController(title: "Mere",message: "",preferredStyle: UIAlertControllerStyle.ActionSheet) let Edit = UIAlertAction(title: "Rediger",style: .Default,handler: { action in }) let Delete = UIAlertAction(title: "Slet",handler: { action in }) let cancelAction = UIAlertAction(title: "Annullere",style: .Cancel,handler: { action in print("Cancelled") }) optionMenu.addAction(Edit) optionMenu.addAction(Delete) optionMenu.addAction(cancelAction) self.presentViewController(optionMenu,animated: true,completion: nil) } 解决方法
在Delete UIAlertAction的初始值设定项中使用参数样式:.destructive
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |