pragma mark -添加手勢
-(void)addGestureRecognizerToTableView{
UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(HideKeyboard)];
[_tableView addGestureRecognizer:tapGesture];
}
-(void)HideKeyboard{
[[[UIApplication sharedApplication]keyWindow]endEditing:YES];
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isKindOfClass:[UITableView class]]) {
return YES;
}
return NO;
}