Regarding willAnimateRotationToInterfaceOrientation:duration:, the “For the More Curious” section in Chapter 8 states that:
I’m even more curious about how this actually happens. Does code in the UIViewController superclass actually check to see that the subclass has overridden this method prior to sending the message? If so, does this imply that there’s a way to introspect subclasses? If so, is that something that’s part of NSObject like respondsToSelector: or is it something that’s part of the Objective-C runtime, like class_copyMethodList? Or, alternatively, does the method simply not exist in the UIViewController superclass at all, such that it’s only present if implemented by the subclass?
The documentation for willAnimateRotationToInterfaceOrientation:duration: seems to imply that the method does exist at UIViewController and that it’s called unconditionally by the UIViewController. To me this implies that UIViewController provides a default implementation, and that subclasses can override the default do-nothing implementation. The documentation for respondsToSelector: describes how to look “up” the inheritance chain, but not down.
As you can probably tell, I’m new to Objective-C, so understanding how this works would be pretty helpful as I get my head around the language and runtime.