Skip to content

Instantly share code, notes, and snippets.

@jackhl
Created May 24, 2012 16:40
Show Gist options
  • Save jackhl/2782633 to your computer and use it in GitHub Desktop.
Save jackhl/2782633 to your computer and use it in GitHub Desktop.
rdar://11520775
23-May-2012 08:52 PM Jack Lawrence:
Summary:
In iOS 5, the behavior of a UISplitViewController was changed such that instead of displaying a UIPopoverController in portrait orientation, the master view is "slid" like a drawer out from the left side of the display to cover a portion of the detail view. Appropriate callback methods have not been implemented to notify the delegate (in this case, the detail view controller) when the master controller was presented/will be presented/was dismissed/will be dismissed, where as they do exist (somewhat) for the UIPopoverController version in iOS 4.
You can see most obviously for the case of was presented/will be presented, the protocol only talks specifically about UIPopoverController objects so off the bat you can see that UIKit is missing some stuff. Furthermore, the documentation surrounding UISplitViewController hasn't been updated to reflect the fact that UIPopoverControllers are no longer used.
Steps to Reproduce:
In a detail view controller that conforms to UISplitViewControllerDelegate and is the delegate of the UISplitViewController, implement every method contained in the UISplitViewControllerDelegate protocol except -splitViewController:shouldHideViewController:inOrientation and set a breakpoint inside or NSLog something in each one, then run the app in the iPad simulator with an iOS version 5.0 or greater.
Expected Results:
You should hit breakpoint(s)/log something when you're in portrait and you swipe across the display or you hit the button in the top left corner to show the master view controller, and again when you dismiss it.
Actual Results:
No feedback is received.
Regression:
None.
Notes:
None.
23-May-2012 09:14 PM Jack Lawrence:
One workaround is in your master view controller subclass, send the detail view controller a message when viewDid/WillAppear: and viewDid/WillDisappear: are called, however this is suboptimal because it does not follow encapsulation of duties and enforces a tighter coupling between the master controller and the detail controller.
24-May-2012 12:46 PM Jack Lawrence:
Regarding the workaround I appended, I firmly believe that the UISplitViewController should be responsible for informing me when an event occurs through its delegate protocol. I don't think the master view controller should be responsible for that. Plus it's not as fine-grained, so all I know is that the master view controller was shown. I don't have a way of determining (without some clunky rotation-checking code that depends on what behavior I've set up) whether or not the user slid it out or the user rotated the device and it appeared.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment