Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To allow subviews lying outside of the superview to respond to touch, override <code>hitTest:withEvent:</code> of the superview.</p> <p><a href="https://developer.apple.com/library/ios/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/EventsiPhoneOS/EventsiPhoneOS.html#//apple_ref/doc/uid/TP40009541-CH2-SW4" rel="noreferrer">Documentation on Event Delivery</a></p> <blockquote> <p>Touch events. The window object uses hit-testing and the responder chain to find the view to receive the touch event. In hit-testing, a window calls hitTest:withEvent: on the top-most view of the view hierarchy; this method proceeds by recursively calling pointInside:withEvent: on each view in the view hierarchy that returns YES, proceeding down the hierarchy until it finds the subview within whose bounds the touch took place. That view becomes the hit-test view.</p> </blockquote> <ol> <li>Create a subclass of UIView.</li> <li>Override hitTest:withEvent.</li> <li>Use this UIView subclass for the superview.</li> </ol> <p>Add method below in subclass:</p> <pre><code>(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { NSEnumerator *reverseE = [self.subviews reverseObjectEnumerator]; UIView *iSubView; while ((iSubView = [reverseE nextObject])) { UIView *viewWasHit = [iSubView hitTest:[self convertPoint:point toView:iSubView] withEvent:event]; if(viewWasHit) { return viewWasHit; } } return [super hitTest:point withEvent:event]; } </code></pre> <p><strong>Note:</strong> Reverse enumerator used since subviews are ordered from back to front and we want to test the front most view first.</p>
    singulars
    1. This table or related slice is empty.
    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