alertView动作按钮为蓝色,直到ios 7
但是在iOS 8上," OK"和"取消"是白色的。
请找到创建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;
}
答案 0 :(得分:1)
这是UIAlertView的deafualt行为。如果您需要任何自定义,可以使用任何自定义警报视图库,如
https://github.com/warrenm/AHAlertView
注意:UIAlertView遵循iOS 7.0 Onwards中的白色主题 https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/Modal.html#//apple_ref/doc/uid/TP40006556-CH64-SW1
答案 1 :(得分:1)
我面临的问题是由于线下
[[UIView appearance] setTintColor:[UIColor whiteColor]];
/ *要自定义类的所有实例的外观,请将相关的外观修改消息发送到类的外观代理。例如,要修改所有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)外观;
通过上面的解释,我可以推断出tintcolor也被应用于AlertView,这会覆盖我们在alertView上的自定义