在UITableView上添加了UITapGestureRecognizer后会导致didSelectRowAtIndexPath失效,原因是UITapGestureRecognizer会截取了tableView的touch事件,导致无法响应行选择,解决方法是重写UIGestureRecognizerDelegate中的
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {//如果当前是tableView
//做自己想做的事
return NO;
}
return YES;
}