pop 或者push一个viewController时候 会有键盘闪现出来 又消失

1  大神a说: iOS 8.3,dismiss alert view时系统会尝试恢复之前的keyboard input
2  大神b说:你要等键盘完全收起之后再pop或者push。直接dispatch_after个0.25秒再执行pop或者push。至于为什么是0.25秒,因为系统键盘收起的duration就是0.25秒。别问我怎么知道的。

    反正我的解决办法是:  [self performSelector:@selector(xxx) withObject:nil afterDelay:0.25];  0.25秒后再pop,或者干啥干啥


1. 在这边去掉键盘

- (void)viewWillDisappear
{
    [super viewWillDisappear:YES];
    
    [self resignTextResponder];
}


2.调用这个performSelector  延时加载

#pragma mark - UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    [self resignTextResponder];
    
    if (buttonIndex == 0)
    {

    }
    else if (buttonIndex == 1)
    {
         [self performSelector:@selector(pushListViewController) withObject:nil afterDelay:0.25];
    }
}


- (void)pushGoodsSourceListViewController
{
    ListViewController *ListViewController = [[ListViewController alloc] init];
    [self.navigationController pushViewController:ListViewController animated:YES];


}

你可能感兴趣的:(pop 或者push一个viewController时候 会有键盘闪现出来 又消失)