UITableViewCell中的UIButton

我有一个在UITableViewCell的子类myCustomCell类2 UIButtons。

我的自定义单元格

黑色轮廓是由“ cellForRowAtIndex ”返回的单元格 (UITableViewCell *)。 这个单元格包含' myCustomCell '作为子视图。 ' myCustomCell '有两个UIButtons和以下属性:

backgroundcolor = clearColor opaque = NO 

单击单元格中除了两个红色框(UIbutton)之外的任何地方,我想' didSelectRowAtIndexPath '被触发。 但是,如果用户点击UIButton,只需要触发目标的select器,而不是“didSelectRowAtIndexPath”。 我怎样才能做到这一点?

如果你像上面提到的那样构build单元格: myCustomCell表示单元格内的一个子视图,它内部有两个button,每个button都有动作,这个动作如下: 当你点击button时, didSelectRowAtIndexPath将不起作用,button将处理触摸事件,因为触摸层次结构将被button的第一个动作所观察,并且不会继续到didSelectRowAtIndexPath,并且当您按下buttondidSelectRowAtIndexPath将处理触摸,因为没有观察者处理这个触摸事件,它将达到didSelectRowAtIndexPath