Skip to content

Instantly share code, notes, and snippets.

Created September 27, 2014 21:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/797aa235dffcf9ed15e3 to your computer and use it in GitHub Desktop.
Save anonymous/797aa235dffcf9ed15e3 to your computer and use it in GitHub Desktop.
/*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