How to edit UIAlertAction text font size and color

后端 未结 7 882
时光取名叫无心
时光取名叫无心 2020-12-06 01:33

How to edit UIAlertAction text size and color? I have taken a UIAlertController acoording to it how to edit the size. This i smy Code



        
相关标签:
7条回答
  • 2020-12-06 02:00

    Here is a solution for changing the text color in Swift:

    let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
    action.setValue(UIColor.black, forKey: "titleTextColor")
    

    Or you could use this extension:

    extension UIAlertAction {
        var titleTextColor: UIColor? {
            get { return self.value(forKey: "titleTextColor") as? UIColor } 
            set { self.setValue(newValue, forKey: "titleTextColor") }
        }
    }
    
    0 讨论(0)
提交回复
热议问题