aleclarson aleclarson - 1 year ago 110
iOS Question

How can I make touch events pass through a UIView (similar to pointer-events:none in CSS)?


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

Here's a jsfiddle to an example of pointer-events: none.

Could I somehow achieve the same behavior for a
by overriding
? Or maybe there is another way to do this?

Thanks for any help.

Answer Source

What you're looking for is commonly called "Event Bubbling".

You may refer to the Apple docs here: (Read the Event Delivery: The Responder Chain Section)

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download