iOS pop到前一个页面时键盘闪一下的问题

来源:互联网 发布:parseint javascript 编辑:程序博客网 时间:2024/06/06 14:01

      当前页面有textfield 并且使用了UIAlertView,并在

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex方法中进行了

[self.navigationControllerpopViewControllerAnimated:YES];操作,返回到前一页面时会产生键盘闪一下的问题,解决办法如下:

if ([UIDevicecurrentDevice].systemVersion.floatValue >=8.0) {

            UIAlertController *alert = [UIAlertControlleralertControllerWithTitle:@"温馨提示"message:@"注册成功"preferredStyle:UIAlertControllerStyleAlert];

            UIAlertAction *action = [UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction *_Nonnull action) {

                [self.navigationControllerpopViewControllerAnimated:YES];

            }];

            [alert addAction:action];

            [selfpresentViewController:alert animated:YEScompletion:nil];

            

        }else

        {

            UIAlertView *alertView = [[UIAlertViewalloc] initWithTitle:@"温馨提示"message:@"注册成功"delegate:selfcancelButtonTitle:@"确定"otherButtonTitles:nil,nil];

            [alertView show];

        }


0 0
原创粉丝点击