pop 一个viewController时候会有键盘闪现出来又消失解决方法

网上问答整理:

出现原因:

因为键盘收起是有动画的,而你在键盘收起的动画开始的时候就pop了,键盘的动画没有执行完当然要在下一个vc里继续执行。所以你要等键盘完全收起之后再pop或者push。直接dispatch_after个0.25秒再执行pop或者push。至于为什么是0.25秒,因为系统键盘收起的duration就是0.25秒


解决方法:
 
(1) 0.25秒后再pop
 
[self performSelector:@selector(xxx) withObject:nil afterDelay:0.25]; 

 

 
(2)代理方法中处理
 
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{ [[alertView textFieldAtIndex:buttonIndex]resignFirstResponder]; }

 

 
 
 
 

 

posted @ 2016-10-13 10:30  北风小南巷  阅读(374)  评论(0编辑  收藏  举报