简体   繁体   English

iOS 8 Alertview操作按钮颜色为白色

[英]iOS 8 Alertview action button colors are in white color

alertView action buttons are in blue color till ios 7 直到iOS 7,alertView操作按钮都呈蓝色

But on iOS 8 , "OK" and "cancel" are in White color. 但是在iOS 8上,“确定”和“取消”为白色。

Please find the block of code that creates the alertview 请找到创建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;
}

This is the deafualt behaviour of UIAlertView. 这是UIAlertView的默认行为。 If you need any customization you can use any custom alertview libraries like, 如果您需要进行任何自定义,则可以使用任何自定义的alertview库,例如,

https://github.com/warrenm/AHAlertView 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 注意:UIAlertView遵循iOS 7.0及以后版本的白色主题https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/Modal.html#//apple_ref/doc/uid/TP40006556-CH64- SW1

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]; 例如,要修改所有UINavigationBar实例的条形颜色:[[UINavigationBar外观] 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; * / +(instancetype)外观;

With the above explanation i could infer that tintcolor was being applied to AlertView as well which overrides our customization on alertView 通过上面的解释,我可以推断出tintcolor也已应用于AlertView,它覆盖了我们对alertView的自定义

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM