Best Practices for Handling Multitouch Events

  • Always implement the event cancelation methods.

    In your implementation, restore the state of a view to what it was before the current multitouch sequence. If you don’t, your view could be left in an inconsistent state, or in some cases, another view could receive the cancelation message.

  • If you handle events in a subclass of UIView, UIViewController, or UIResponder:

    • 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.

  • If you handle events in a subclass of any other UIKit responder class:

    • 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].

  • Do not forward events to other responder objects of the UIKit Framework.

    Instead, forward events to instances of your own subclasses of UIView. Additionally, make sure these responder objects are aware that event forwarding is taking place and tat they can receive touches that are not bound to them.

  • Do not explicitly send events up the responder chain through the nextResponder method; instead, invoke the superclass implementation and let UIKit handle responder-chain traversal.

  • Do not use round-to-integer code in your touch handling because you lose precision.

    iOS reports touches in a 320x480 coordinate space to maintain source compatiblity. However, on high-resolution devices, the resolution is actually twice as high in each dimension(640x960), which means that touches can land on half-point boundaries on high-resolution devices. On older devices, touches land only on full-point boundaries.