ios跳转页面 有键盘闪现出来又消失
由于项目中反馈在有textField的页面时,页面跳转会出现键盘闪现出来又消失,
原因是由于键盘动画尚未结束, 就push 或 pop 了;
网上有说法采用: [self performSelector:@selector(xxx) withObject:nil afterDelay:0.25];延迟0.25秒, 但结果也不是很理想
在 iOS 8.3,dismiss alert view时系统会尝试恢复之前的keyboard input
官方推荐使用UIAlertController
因此, 判断8.0之前的版本使用UIAlertView, 之后使用UIAlertController
if (SYSTEM_VERSION>=8.0) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"该手机号已经注册,直接去登录呗?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"登录" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[self logingVCller];
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"该手机号已经注册,直接去登录呗?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"登录", nil];
[alert show];
}