如何在iOS9中更改UIAlertController按钮文本颜色? [英] How to change UIAlertController button text colour in iOS9?
问题描述
问题类似于 iOS 8 UIActivityViewController和UIAlertController按钮文本颜色使用窗口的tintColor ,但在iOS 9中。
The question is similar to iOS 8 UIActivityViewController and UIAlertController button text color uses window's tintColor but in iOS 9.
我有一个UIAlertController,即使我试图设置
I have a UIAlertController and the dismiss button keeps white colour even I have tried to set
[[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blackColor]];
UIAlertController *strongController = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:preferredStyle];
strongController.view.tintColor = [UIColor black];
推荐答案
我在过去遇到过类似的事情这个问题似乎源于这样一个事实:警报控制器的视图还没有准备好在它出现之前接受 tintColor
更改。或者,尝试设置提示控制器的色调 AFTER :
I've run into something similar in the past and the issue seems to stem from the fact that the alert controller's view isn't ready to accept tintColor
changes before it's presented. Alternatively, try setting the tint color AFTER you present your alert controller:
[self presentViewController:strongController animated:YES completion:nil];
strongController.view.tintColor = [UIColor black];
这篇关于如何在iOS9中更改UIAlertController按钮文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!