添加手势后,didSelectRowAtIndexPath:(
2016-09-05 本文已影响20人
纯阳子_
//参考网址:http://blog.csdn.net/iosevanhuang/article/details/8830499
查阅了相关文档后找到了一种可行的解决方法:重写UIGestureRecognizerDelegate中的
- (BOOL)gestureRecognizer:(UIGestureRecognizer*)gestureRecognizer shouldReceiveTouch:(UITouch*)touch方法。代码如下:
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
// 输出点击的view的类名
NSLog(@"%@", NSStringFromClass([touch.viewclass]));
// 若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件
if([NSStringFromClass([touch.viewclass]) isEqualToString:@"UITableViewCellContentView"]) {
returnNO;
}
returnYES;
}