Note that there are some explanatory texts on larger screens.

plurals
  1. PODisable touches on UIView background so that buttons on lower views are clickable
    text
    copied!<p>Basically, here is my view hierarchy (and I appologize if this is hard to read... I'm new here so posting suggestions happily accepted)</p> <hr> <p>--AppControls.xib <br> -------(UIView)ControlsView <br> ----------------- (UIView)TopBar <br> ----------------- -------------- btn1, btn2, btn3 <br> ----------------- UIView)BottomBar <br> ----------------- --------------slider1 btn1, btn2 <br>--PageContent.xib <br>----------------- (UIView)ContentView <br> ----------------- --------------btn1, btn2, btn3 <br>----------------- --------------(UIImageView)FullPageImage</p> <hr> <p>My situation is that I want to hide and show the controls when tapping anywhere on the PageContent thats not a button and have the controls show, much like the iPhone Video Player. However, when the controls are shown I still want to be able to click the buttons on the PageContent. </p> <p>I have all of this working, except for the last bit. When the controls are showing the background of the controls receives the touch events instead of the view below. And turning off user interaction on the ControlsView turns it off on all its children. </p> <p>I have tried overriding HitTest on my ControlsView subclass as follows which I found in a similar post: </p> <pre><code>- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event{ UIView *hitView = nil; NSArray *subviews = [self subviews]; int subviewCount = [subviews count]; for (int subviewIndex = 0; !hitView &amp;&amp; subviewIndex &lt; subviewCount; subviewIndex++){ hitView = [[subviews objectAtIndex:subviewIndex] hitTest:point withEvent:event]; } return hitView; } </code></pre> <p>However, at this point my slider doesn't work, nor do most of the other buttons, and really, things just start getting weird.</p> <p>So my question is in short: How do I let all the subviews of a view have touch events, while the super view's background is unclickable, and the buttons on views below can receive touch events. </p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload