0

I'm using the default style of UIAlertControllerand UIAlertAction but I'm getting white text on white background as in the screenshot

Here is my code:

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];

I searched for the problem and I found that I can add tintColor for the UIAlertController as follow but it didn't work.

alert.view.tintColor = [UIColor blackColor];

Is this a normal behaviour or is there anything wrong in my code?

4

1 回答 1

1

可以通过外观 API 设置 UIAlertController 的色调颜色:

[[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blackColor]];
于 2014-10-19T08:37:03.260 回答