UIAlertController tint color defaults to blue on highlight

后端 未结 11 1119
傲寒
傲寒 2021-01-01 10:56

I\'m use the following code to present a UIAlertController action sheet with the item text as red. I\'ve used the tint property to set the color.

UIAlertCont         


        
11条回答
  •  情书的邮戳
    2021-01-01 11:04

    To prevent the fast "popping up" of the new tint color the alpha value of the alert controller can be animated. Then it looks exactly the same as if there where no bug:

        alertController.view.alpha = 0.0
        presentViewController(alertController, animated: false) {
            alertController.view.tintColor = UIColor.redColor()
            UIView.animateWithDuration(0.2, animations: { alertController.view.alpha = 1.0 }, completion: nil)
        }
    

提交回复
热议问题