iOS 8: цвет стиля UIAlertController по умолчанию
Я использую стиль по умолчанию UIAlertController
а также UIAlertAction
но я получаю белый текст на белом фоне, как на скриншоте
Вот мой код:
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"0237826726" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[self callPlaceNumber:@"0237826726"];
}];
[alert addAction:defaultAction];
UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[alert dismissViewControllerAnimated:YES completion:nil];
}];
[alert addAction:cancel];
[self presentViewController:alert animated:YES completion:nil];
Я искал проблему и обнаружил, что могу добавить tintColor
для UIAlertController
как следует, но это не сработало.
alert.view.tintColor = [UIColor blackColor];
Это нормальное поведение или что-то не так в моем коде?
1 ответ
Решение
Задать цвет оттенка для UIAlertController можно с помощью API внешнего вида:
[[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blackColor]];