Reputation: 517
Whenever I try to present this alert, it keeps appearing in some weird location.. Any ideas on how to fix this?
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
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