太極者無極而生 太極者無極而生 - 5 months ago 35
iOS Question

On iOS, if a superview's userInteractionEnabled is NO, then all subviews are disabled as well?

I thought when a view is touched or tapped on, its handler get called first, and then its superview's handler is called (propagate upward).

But is it true that if the superview's

userInteractionEnabled
is set to NO, then all subviews and offspring is also disabled for user interaction? What if we want to disable for just the main view but don't want to disable for the subviews?

Answer

You cant do that,

Instead you would change the arrangment of your views like following:

Main View-> subViews

To

Container View -> Main View that you want to set as inactive
               -> other views that you want to still active

So your current main view and you current subviews will become siblings, children of a new container view