Create a gist now

Instantly share code, notes, and snippets.

anonymous /SpltViewDelegate.m
Created Sep 27, 2014

/*Dealing with three-level hierarchy:
Feeds > Timeline > Article
Primary (master) is nav controller with Feeds and Timeline.
Secondary (detail) is nav controller with Article.
I get a reference to primary and secondary navigation controllers when app is launching.
Storyboard uses show segue for Feeds > Timeline. It uses showDetail segue for Timeline > Article.
This is probably not the final version of this code for my app, but so far it's doing what I want.*/
#pragma mark - UISplitViewControllerDelegate
- (UIViewController *)primaryViewControllerForCollapsingSplitViewController:(UISplitViewController *)splitViewController {
return self.masterNavigationController;
}
- (UIViewController *)primaryViewControllerForExpandingSplitViewController:(UISplitViewController *)splitViewController {
return self.masterNavigationController;
}
- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController {
return YES;
}
- (UIViewController *)splitViewController:(UISplitViewController *)splitViewController separateSecondaryViewControllerFromPrimaryViewController:(UIViewController *)primaryViewController {
return self.detailNavigationController;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment