I've added a button to a tableview cell, but I'm having two problems with it:
1) I've invoked a setTarget:action:
method on the button, but the action:
method never gets called:
[playButton addTarget:self action:@selector(playButtonPressed:)
forControlEvents:UIControlEventTouchUpInside];
2) the cell itself ends up getting selected on the touch, invoking didSelectRowAtIndexPath
, which I don't want to happen.
I've verified that the button is at least seeing the touch by setting its showsTouchWhenHighlighted
property and seeing it "glow" when pressed. But for whatever reason it looks like the touch event is then getting passed up to its cell superview instead of being handled by the button itself.
I've tried adding the button directly to the cell's contentView
, as well as to other cell subviews, with no effect. I've also made sure that the button's superview(s) were all touch-enabled.
Any thoughts?
Howard