Sundar_Mob
Sundar_Mob

Reputation: 155

iOS 8 Alertview action button colors are in white color

alertView action buttons are in blue color till ios 7

But on iOS 8 , "OK" and "cancel" are in White color.

Please find the block of code that creates the alertview

+(UIAlertView*)showWithMessage:(NSString*)message withTitle:(NSString*)title {
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:title
                                                    message:message
                                                   delegate:nil
                                          cancelButtonTitle:tibbrLocalizedString(@"all_view.ok.button", @"Ok button title for alert")
                                          otherButtonTitles:nil];
    [alert show];
    return alert;
}

Upvotes: 1

Views: 1081

Answers (2)

Sundar_Mob
Sundar_Mob

Reputation: 155

Issue that i was facing is due to below line

        [[UIView appearance] setTintColor:[UIColor whiteColor]];

/* To customize the appearance of all instances of a class, send the relevant appearance modification messages to the appearance proxy for the class. For example, to modify the bar tint color for all UINavigationBar instances: [[UINavigationBar appearance] setBarTintColor:myColor];

Note for iOS7: On iOS7 the tintColor property has moved to UIView, and now has special inherited behavior described in UIView.h.
This inherited behavior can conflict with the appearance proxy, and therefore tintColor is now disallowed with the appearance proxy.

*/ + (instancetype)appearance;

With the above explanation i could infer that tintcolor was being applied to AlertView as well which overrides our customization on alertView

Upvotes: 1

LML
LML

Reputation: 1667

This is the deafualt behaviour of UIAlertView. If you need any customization you can use any custom alertview libraries like,

https://github.com/warrenm/AHAlertView

Note : The UIAlertView follows the whitish theme from iOS 7.0 Onwards https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/Modal.html#//apple_ref/doc/uid/TP40006556-CH64-SW1

Upvotes: 1

Related Questions