UITableViewCell中的自定义UIView阻止uitableviewcell接收事件

时间:2012-05-23 18:40:57

标签: ios uitableview uiview ontouchevent touchesbegan

我有一个自定义的UITableViewCell,即我将UITableViewCell类子类化  在填充uitableview的每个单元格(或行)时,我正在创建自定义UITableViewCell,它由图像和一些标签组成。

现在当我在自定义'UITableViewCell'类中重写以下方法时,

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    NSLog(@"CLICKED CLICKED CELL CLICKED CLICKED");
    [super touchesBegan:touches withEvent:event];
 }
如果我点击我添加到我的自定义uitableviecell的自定义视图,它永远不会被调用,但是当我点击其上没有自定义视图的区域时它很好(事件触发)。

我的目标很简单,我想在uitableview中检测每行中的任何触摸(uitableviewcell)。

2 个答案:

答案 0 :(得分:3)

我今天遇到过类似的问题,我无法选择单元格,因为它有一个带有scrollView的自定义UIView。尝试在您的UIView的子视图上设置userInteractionIsEnabled = false

答案 1 :(得分:0)

plz尝试覆盖此方法

 - (void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event {}   
相关问题