点击键盘,手势会穿透键盘,点击到键盘底下的Cell,这是什么原因?

点击键盘,手势会穿透键盘,点击到键盘底下的Cell,这是什么原因?

Cell上有textview、点击时tableview下移,可以使得cell被弹出的键盘挡上,从而解决问题

手势添加的位置不对!

键盘和cell不要重叠

当键盘显示或消失时,系统会发送相关的通知:
UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification

截取通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];

  • (void)keyboardWillShow:(NSNotification *)noti {
    //键盘输入的界面调整
    //键盘的高度 float height = 216.0;
    CGRect frame = self.view.frame;
    frame.size = CGSizeMake(frame.size.width, frame.size.height - height);
    [UIView beginAnimations:@"Curl"context:nil];//动画开始
    [UIView setAnimationDuration:0.30];
    [UIView setAnimationDelegate:self];
    [self.view setFrame:frame];
    [UIView commitAnimations]; }

大概就是这么个思路

手势添加的位置不对!

可能程序中重写了hitTest方法,对事件传递进行了拦截,查看此方法,不进行拦截即可。