手势代理UIGestureRecognizerDelegate
UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHiden)];
tap.delegate=self;
[self.view addGestureRecognizer:tap];
#pragma mark- UIGestureRecognizerDelegate
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
return NO; //关闭手势
}
return YES;
}
参考链接http://blog.csdn.net/liumude123/article/details/51416555