0

I am trying to show UIAlertController view while UIPopoverController view is open, but the alert view goes back of popover view like this.

enter image description here

How can I make the alert view to the foremost of the window?

Here is my code. Thank you.

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"test" message:@"test" preferredStyle:UIAlertControllerStyleAlert];

[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
                                        {

                                        }]];

[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:alertController animated:YES completion:nil];

1 Answers1

0

I solved this issue by myself.

I was calling [[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:alertController animated:YES completion:nil]; from NSObject class.

I handed the parent view controller itself to the NSObject class (which means delegated) and call like this:[parentVC presentViewController:alertController animated:YES completion:nil];.