Deepak
Deepak

Reputation: 1441

UIAlertView button title goes white in iOS 8

I am working a old application which have lots of alert view. This application working fine in iOS7 but in iOS8 Alert view buttons text color goes white and it is not visible. Functionality wise it is working in iOS8 too. Please see the screen shot for more understanding. enter image description here

Upvotes: 0

Views: 534

Answers (1)

Vijay yadav
Vijay yadav

Reputation: 1230

You Try This Code

  - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view from its nib.

        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Alrt" message:@"This is the Message" preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *cancelAction = [UIAlertAction
                                       actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action")
                                       style:UIAlertActionStyleCancel
                                       handler:^(UIAlertAction *action)
                                       {
                                           NSLog(@"Cancel action");
                                       }];

        UIAlertAction *okAction = [UIAlertAction
                                   actionWithTitle:NSLocalizedString(@"OK", @"OK action")
                                   style:UIAlertActionStyleDefault
                                   handler:^(UIAlertAction *action)
                                   {
                                       NSLog(@"OK action");
                                   }];

        [alertController addAction:cancelAction];
        [alertController addAction:okAction];

        [self presentViewController:alertController animated:YES completion:nil];
    }

enter image description here

Upvotes: 1

Related Questions