I have a subview thats goes onto the screen animated, and when it is on the screen, I want the superview (in my case, the view in the background), to ignore touch events.
I tried everything but it does not work.
Is there any way to ‘force’ the superview to stop receiving touch events?
Thanks!
When you say the superview, I assume you you mean the animating view’s superview. Apple’s documentation is very unspecific about
userInteractionEnabled, but I think that if you set it to false, it disables touch events on the specific view, but not on its subviews. I would suggest that you do it recursively. Here is an example of code that you could use to disable/enable ALL touch events on a view:You could then call this on your superview
[self setInteraction:NO onView:[self superview]]. This would, of course, disable your touch events as well, since you are disabling them recursively on your superview. Of course you can always re-enable your touch events[self setUserInteractionEnabled:NO].Also, Apple’s UIView Class Reference mentions that some UI components override this method: