I have three custom buttons with non-rectangular images close to each other in my view. Then I have a problem with touchable area's of each button overlap with other buttons. So how can I limit the touchable area of each buttons to get the corresponding actions?
You can overwrite -pointInside:withEvent:
, that internally will be used for hit testing.
A nice project using this technique is OBShapedButton, where transparent pixel will not trigger a hit.
Use two components. A UIImageView
with a smaller UIButton
on top.
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