UIAlertController呈现在奇怪的位置

时间:2016-03-12 05:36:09

标签: ios uialertcontroller

每当我尝试提示此警报时,它会一直出现在某个奇怪的位置。有关如何解决这个问题的想法吗?

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

1 个答案:

答案 0 :(得分:1)

我认为您将窗框更改为加倍宽度和高度,因此它显示在那里。您可以记录下来进行检查。