我目前有一个自定义 UITableViewCell ,其中包含一个 UIImageView 并试图在 UIImageView 上添加一个 UITapGestureRecognizer ,但没有运气。这是代码片段。
//within cellForRowAtIndexPath (where customer table cell with imageview is created and reused)
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleImageTap:)];
tap.cancelsTouchesInView = YES;
tap.numberOfTapsRequired = 1;
tap.delegate = self;
[imageView addGestureRecognizer:tap];
[tap release];
// handle method
- (void) handleImageTap:(UIGestureRecognizer *)gestureRecognizer {
RKLogDebug(@"imaged tab");
}
我还在单元格和 UIImageView 的超级视图上设置了 userInteractionEnabled 但仍然没有运气,有什么提示吗?
编辑:
我还通过 cell.selectionStyle = UITableViewCellSelectionStyleNone; 删除了单元格的选择;这可能是一个问题