每当我尝试提示此警报时,它会一直出现在某个奇怪的位置。有关如何解决这个问题的想法吗?
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];
答案 0 :(得分:1)
我认为您将窗框更改为加倍宽度和高度,因此它显示在那里。您可以记录下来进行检查。