Change button title color in UIAlertView

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

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

\"enter

相关标签:
7条回答
  • 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]];
    
    0 讨论(0)
提交回复
热议问题