UIPresentationController is (currently) a deficient API

iOS 8 brings a new and welcome class to UIKit: UIPresentationController, which reifies the presentation of view controllers in a configurable object whose lifetime can also be used to more cleanly manage auxiliary UI elements associated with that presentation. Conceptually, popovers are a form of presentation, so they are now managed via a subclass of UIPresentationController, logically … Continue reading UIPresentationController is (currently) a deficient API

-targetViewControllerForAction:sender: is smarter than it seems

The new -[UIViewController targetViewControllerForAction:sender:] method (and its related methods, -showViewController:sender: and -showDetailViewController:sender:) in iOS 8 takes a clever responder chain-based approach to showing view controllers in a size-class-adaptable way. Basically, all UIViewController instances respond to -showViewController:sender: and -showDetailViewController:sender:, but their implementations use -targetViewControllerForAction:sender: to find the appropriate view controller to actually do the showing. In the case of -showViewController:sender:, this is likely an enclosing UINavigationController, and in the case … Continue reading -targetViewControllerForAction:sender: is smarter than it seems

The Behavior of Super

(I recently posted this thread to Apple’s objc-language mailing list. I welcome feedback there or here.) A recent Twitter conversation spurred me to think about how we use super in Objective-C. I have two main problems with the current functionality of super: It can only be used to dispatch to the immediate superclass.It’s sometimes useful to skip the superclass’s implementation from within … Continue reading The Behavior of Super

An Auto Layout Adventure: NSCell, -intrinsicContentSize, and -constraintsAffectingLayoutForOrientation:

Recently my coworker Tom was having a hard time with converting a Mac NIB to Auto Layout. The NIB contained a split view; on the left was an instance of OACalendarView, and on the right was a scroll view. The holding priorities of the left and right panes were 251 and 250, respectively, and the … Continue reading An Auto Layout Adventure: NSCell, -intrinsicContentSize, and -constraintsAffectingLayoutForOrientation: