如何在iOS9中更改UIAlertController按钮文本颜色?

这个问题类似于iOS 8 UIActivityViewController和UIAlertController按钮文本颜色使用的窗口'但在iOS 9中,它会着色

我有一个UIAlertController,即使我试着设置,关闭按钮仍保持白色

[[UIView appearancewhen containedin:[UIAlertController class],nil]setTintColor:[UIColor blackColor]];
UIAlertController*strongController=[UIAlertController alertControllerWithTitle:title
信息:信息
preferredStyle:preferredStyle];
strongController.view.tintColor=[UIColor black];

我在过去也遇到过类似的情况,问题似乎源于这样一个事实:警报控制器的视图在显示之前不准备接受tintColor更改。或者,在显示警报控制器后,尝试设置淡色

[自我呈现视图控制器:strong控制器动画:是完成:无];
strongController.view.tintColor=[UIColor black];

发表评论