In CSS, pointer-events:none;
allows click events to pass through an element. I'm curious if there is anything similar that I can do in Objective-C on iOS for UIView
s.
Here's a jsfiddle to an example of pointer-events: none.
Could I somehow achieve the same behavior for a UIView
by overriding hitTest:withEvent:
? Or maybe there is another way to do this?
Thanks for any help.
What you're looking for is commonly called "Event Bubbling".
You may refer to the Apple docs here: https://developer.apple.com/documentation/uikit/understanding_event_handling_responders_and_the_responder_chain
So your basic instinct was right, you in fact do need utilize hitTest:withEvent:
, but you can further customize things by hooking up into the Responder chain. That section has a very neat example.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments