Keyboard pops up after UIAlertView is dismissed on iOS 8.3 for iPad Keyboard pops up after UIAlertView is dismissed on iOS 8.3 for iPad ios ios

Keyboard pops up after UIAlertView is dismissed on iOS 8.3 for iPad


If your deployment target is iOS 8+, try UIAlertController.

Here's a quick fix for UIAlertView: delay the invocation of showing the alert view when your text field or text view resigns first responder.

[self performSelector:@selector(showAlertView) withObject:nil afterDelay:0.6];


If anyone struggles with this, I hope this will help:

if (NSClassFromString(@"UIAlertController")) {    UIAlertController* alert = ...}else {    UIAlertView* alert = ...}


you need to change alert for ios 8.3

first put this in your view

#define IS_IOS8 [[UIDevice currentDevice].systemVersion floatValue] >= 8.0

then

if (IS_IOS8) {        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Unsaved Changes" message:@"Your changes have not been saved. Discard changes?" preferredStyle:UIAlertControllerStyleAlert];        UIAlertAction *saveAction = [UIAlertAction                                    actionWithTitle:@"Save"                                    style:UIAlertActionStyleCancel                                    handler:^(UIAlertAction *action)                                    {                                        [self save];                                    }];        UIAlertAction *cancelAction = [UIAlertAction                                   actionWithTitle:@"Cancel"                                   style:UIAlertActionStyleCancel                                   handler:^(UIAlertAction *action)                                   {                                       [alertVC dismissViewControllerAnimated:YES completion:nil];                                   }];        UIAlertAction *discardAction = [UIAlertAction                                   actionWithTitle:@"Discard"                                   style:UIAlertActionStyleCancel                                   handler:^(UIAlertAction *action)                                   {                                       [alertVC dismissViewControllerAnimated:YES completion:nil];                                   }];        [alertVC addAction:saveAction];        [alertVC addAction:cancelAction];        [alertVC addAction:discardAction];        [self.view.window.rootViewController presentViewController:alertVC animated:YES completion:nil];

this will help you as it helps me in same problem.above code is compatible with both ios 7 & 8