Change button title color in UIAlertView

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

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

\"enter

7条回答
  •  不要未来只要你来
    2021-01-11 18:18

    The Travis Weerts answer should work if you are using a UIAlertController. For those using UIAlertView, you can use the UIView appearance settings.

    You can aim the alerts component this way on iOS < 9 :

    [[UIView appearanceWhenContainedIn:[UIAlertView class], nil] setTintColor:[UIColor redColor]];
    [[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor redColor]];
    

    And on iOS 9 :

    [[UIView appearanceWhenContainedInInstancesOfClasses:@[[UIAlertView class]]] setTintColor:[UIColor redColor]];
    [[UIView appearanceWhenContainedInInstancesOfClasses:@[[UIAlertController class]]] setTintColor:[UIColor redColor]];
    

提交回复
热议问题