当轻拍和UITableView的didSelectRow互相影响
作者:
路这么长 | 来源:发表于
2016-11-17 10:30 被阅读26次UITapGestureRecognizer*oneTap = [[[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(hideKeyBoard)]autorelease];
oneTap.delegate=self;
oneTap.numberOfTouchesRequired=1;
[self.viewaddGestureRecognizer:oneTap];
重写协议方法,让didSelectRow响应
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
//输出点击的view的类名
NSLog(@"%@", NSStringFromClass([touch.view class]));
//若为UITableViewCellContentView(即点击了tableViewCell),则不截获Touch事件
if([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
returnNO;
}
returnYES;
}
本文标题:当轻拍和UITableView的didSelectRow互相影响
本文链接:https://www.haomeiwen.com/subject/anddpttx.html
网友评论