Ios UIAlertController出现在奇怪的位置

Ios UIAlertController出现在奇怪的位置,ios,uialertcontroller,Ios,Uialertcontroller,每当我试图显示此警报时,它总是出现在一些奇怪的位置。。有没有办法解决这个问题 我想你们把窗框改成了双倍的宽度和高度,所以它就显示在那个里了。您可以将此记录下来进行检查。您是否使用了IQKeyboard(或其他类似的SDK)?@Lumialxk nope!你是说我应该作为这个问题的潜在解决方案,还是说如果我有问题的话,这可能就是问题本身?我想你把窗框改成了双倍宽度和高度,所以它就出现了。您可以将此记录下来进行检查。@Lumialxk哦,我的上帝。。。。我爱你。。。把你的评论作为回答,我会接受的!

每当我试图显示此警报时,它总是出现在一些奇怪的位置。。有没有办法解决这个问题


我想你们把窗框改成了双倍的宽度和高度,所以它就显示在那个里了。您可以将此记录下来进行检查。

您是否使用了IQKeyboard(或其他类似的SDK)?@Lumialxk nope!你是说我应该作为这个问题的潜在解决方案,还是说如果我有问题的话,这可能就是问题本身?我想你把窗框改成了双倍宽度和高度,所以它就出现了。您可以将此记录下来进行检查。@Lumialxk哦,我的上帝。。。。我爱你。。。把你的评论作为回答,我会接受的!我用nativeBounds创建了我的UIWindow,但忘了除以NativeScale….'(…再次感谢你!
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];