Gukki5
Gukki5

Reputation: 517

UIAlertController Presenting in Weird Location

Whenever I try to present this alert, it keeps appearing in some weird location.. Any ideas on how to fix this?

Screenshot

UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Logout"
                                                                       message:@"Are you sure you want to logout?"
                                                                preferredStyle:UIAlertControllerStyleAlert];


[alert addAction:[UIAlertAction actionWithTitle:@"Yes"
                                 style:UIAlertActionStyleDestructive
         handler:^(UIAlertAction * _Nonnull action) {

             [[NSUserDefaults standardUserDefaults] setBool:@"NO" forKey:@"auth"];
             [(AppDelegate *)[UIApplication sharedApplication].delegate changeRootViewController:[Login sharedLogin]];

         }]];

[alert addAction:[UIAlertAction actionWithTitle:@"No"
                                                  style:UIAlertActionStyleCancel
                                                handler:^(UIAlertAction * _Nonnull action) {
                                                    [alert dismissViewControllerAnimated:YES completion:nil];
                                                }]];
[self presentViewController:alert animated:YES completion:nil];

Upvotes: 1

Views: 61

Answers (1)

Lumialxk
Lumialxk

Reputation: 6369

I think you changed window frame to double width and height so it showed there. You can log this to check.

Upvotes: 1

Related Questions