UIAlertController change font color

后端 未结 8 767
时光取名叫无心
时光取名叫无心 2021-02-05 06:43

Here\'s my code that creates the UIAlertController

    // Create the alert controller
    var alertController = UIAlertController(title: \"Are you sure you want          


        
8条回答
  •  北海茫月
    2021-02-05 07:37

    Swift 4.2

    One way of doing this is to make extension on UIAlertController, with this all of your app alerts whil have the same tint color. But it leaves destructive actions in red color.

     extension UIAlertController{
            open override func viewDidLayoutSubviews() {
                super.viewDidLayoutSubviews()
               self.view.tintColor = .yourcolor
            }
        }
    

提交回复
热议问题