Note that there are some explanatory texts on larger screens.

plurals
  1. POEvent handling in subclass of UIView
    text
    copied!<p>As the guide <a href="https://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/multitouch_background/multitouch_background.html#//apple_ref/doc/uid/TP40009541-CH5-SW9" rel="nofollow">Event Handling Guide for iOS</a> mentions, when you create your own subclass of UIView:</p> <p>All views that process touches expect to receive a full touch-event stream, so when you create your subclass, keep in mind the following rules:</p> <pre><code> - If your custom responder is a subclass of UIView or UIViewController, you should implement all of the event handling methods. - If you subclass any other responder class, you can have a null implementation for some of the event methods. **- In all methods, be sure to call the superclass implementation of the method.** </code></pre> <p>However in the "Best Practices for Handling Multitouch Events" part of the guide, it also says:</p> <p>If you handle events in a subclass of UIView, UIViewController, or UIResponder:</p> <pre><code> - Implement all of the event handling methods, even if your implementations of those methods do nothing. **- Do not call the superclass implementation of the methods.** </code></pre> <p>If you handle events in a subclass of any other UIKit responder class:</p> <pre><code> - You do not have to implement all of the event handling methods. **- In the methods you do implement, be sure to call the superclass implementation. For example, [super touchesBegan:touches withEvent:event].** </code></pre> <p>Here is my question, should I call the the super class implementation like <code>[super touchesBegan:touches withEvent:event]</code> or not?</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