For the More Curious: The Responder Chain

In Chapter 7, we talked briefly about UIResponder and the first responder. A UIResponder can receive touch events. UIView is one example of a UIResponder subclass, but there are many others, including UIViewController, UIApplication, and UIWindow. You are probably thinking, But you can’t touch a UIViewController. It’s not an on-screen object. You are right – you cannot send a touch event directly to a UIViewController, but view controllers can receive events through the responder chain.

Every UIResponder has a pointer called nextResponder, and together these objects make up the responder chain (Figure 12.5). A touch event starts at the view that was touched. The nextResponder of a view ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.