Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can subclass UIView and override hitTest:withEvent: in a way to pass touch events to a view that you specify (_backView):</p> <pre><code>- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { UIView *view = [super hitTest:point withEvent:event]; if (view == self) { view = _backView; } return view; } </code></pre> <p>If the touch event was to be handled by this view it would be passed to "_backView" (that can be an IBOutlet so that it can be set using interface builder) ; and if it was to be handled by any child view just return that child (the result of <code>[super hitTest:point withEvent:event]</code>;)</p> <p>This solution is fine as long as you know what view you need to pass the events to; besides don't know if it has problems since we are returning a view (_backView) that is not a subview of the current UIView !! but it worked fine in my case.</p> <p>A better solution might be the one mentioned in <a href="https://stackoverflow.com/questions/3427619/disable-touches-on-uiview-background-so-that-buttons-on-lower-views-are-clickabl">Disable touches on UIView background so that buttons on lower views are clickable</a> There its mentioned to use <code>-pointInside:withEvent:</code> ; compared to previous solution its better in the way that you don't need to specify a '_backView' to receive the events (the event is simply passed to the next view in chain)! drawback might be that we need to perform <code>-pointInside:withEvent:</code> on all subviews (might be of negligible overhead though)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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