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

前端 未结 7 1391
小鲜肉
小鲜肉 2021-01-31 03:15

With the latest iOS 8.3 release, our app starts to have a weird behavior.

After finishing textfield editing, the user can click the close button which brings up an

7条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 03:52

    Try using the below code. It works fine for iOS 8 and below version

    if (IS_OS_8_OR_LATER) {
            UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
    
            UIAlertAction *cancelAction = [UIAlertAction
                                         actionWithTitle:@"OK"
                                         style:UIAlertActionStyleCancel
                                         handler:^(UIAlertAction *action)
                                         {
    
                                         }];
            [alertVC addAction:cancelAction];
    
            [[[[[UIApplication sharedApplication] windows] objectAtIndex:0] rootViewController] presentViewController:alertVC animated:YES completion:^{
    
            }];
        }
        else{
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
            [alert show];
        }
    

    }

提交回复
热议问题