Change button title color in UIAlertView

后端 未结 7 1389
予麋鹿
予麋鹿 2021-01-11 17:29

How can I change the color of the UIAlertView button title.

\"enter

7条回答
  •  伪装坚强ぢ
    2021-01-11 18:05

    The best way (And easiest) is the following:

    alert = UIAlertController(title: "foo", message: "foo", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction.... foo
    ...foo
    alert.view.backgroundColor = UIColor.orangeColor()
    alert.view.tintColor = UIColor.orangeColor()
    alert.view.layer.cornerRadius = 0.5 * alert.view.bounds.size.width
    

    It gives also a plus effect of a "round faded orange circle" in the background.

    Hope it helps

提交回复
热议问题