简体   繁体   English

如何更改 UIAlertAction 标题的颜色

[英]How to change the color of UIAlertAction Title

I want to change the color of title of UIAlertActionSheet.我想更改 UIAlertActionSheet 的标题颜色。

"alert.view.tintColor" changes the color of all the action buttons but not title. “alert.view.tintColor”改变所有动作按钮的颜色,但不改变标题。

you can try this an it may work with you你可以试试这个,它可能对你有用

let myCancelAlert = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.default, handler:nil)
            myCancelAlert.setValue(UIColor.black, forKey: "titleTextColor")
            alert.addAction(cancelAlert)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM