Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Understanding UIResponder by Dirk Smith

Understanding UIResponder by Dirk Smith

Dirk discusses UIResponder at CocoaHeads Durham in July 2012

Triangle Cocoa

July 28, 2012

Transcript

8 slides
  1. What is UIResponder? ✤ Basis of many regularly used components:

    UIView, UIViewController, AppDelegate, UIWindow ✤ Important for interacting with the application
  2. UIResponder Core Methods ✤ touchesBegan:withEvent: ✤ touchesMoved:withEvent: ✤ touchesEnded:withEvent: ✤

    touchesCancelled:withEvent: ✤ becomeFirstResponder ✤ canBecomeFirstResponder ✤ canResignFirstResponder ✤ isFirstResponder
  3. UIResponder - First Responder ✤ An object can only become

    a first responder if the existing first responder returns TRUE for canResignFirstResponder and the current object returns TRUE for canBecomeFirstResponder ✤ The default for canResignFirstResponder is TRUE and FALSE for canBecomeFirstResponder ✤ InputView is shown when UIResponder becomes FirstResponder (like a keyboard)
  4. UIResponder Chain ✤ nextResponder defaults to nil; subclasses are responsible

    for determining the next object in the chain ✤ UIView returns its ViewController if its managed by one, or its superview if not ✤ UIViewController returns the UIWindow ✤ UIWindow returns the AppDelegate ✤ Event will be thrown out if not handled

More Decks by Triangle Cocoa

Other Decks in Programming