I placed a small UIView
inside a UITableViewCell
.
UIView
, I would like to open a popup.UIView
, I would like to perform what it's defined in the UITableView
"didSelectRowAtIndexPath" function.What it's happening at the moment is that when I click on the view both things happen: the popup is opened and the "didSelectRowAtIndexPath" function is trigged.
How can I make sure that when I click on that UIView
the "didSelectRowAtIndexPath" function is not triggered?
current implementation:
I defined a UITapGestureRecognizer
for the UIView
inside my custom UITableViewCell
class.
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(MyCustomTableViewCell.clickOnHelp(_:)))
myClickAreaUIView.addGestureRecognizer(tapGesture)
The best solution I suggest is to change the UIView
to a UIButton
and handle the touch with a touchUpInside
on the button.
This way you will reach your objective, as UIButton
automatically prevents touch event forwarding to superview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With