Reputation: 1277
I'm trying to upgrade my App from iphone only to Universal. I've a critical requirement to be able to hide the master view and show only the detail (in landscape) for a significant part of the App.
All roads point to MGSplitViewController.
However it hasn't had many updates since it was first published. Getting it compiling with ARC was straight forward. However I've spent most of my time trying to understand how to transition away from Xib to Storyboard for this code.
I'm a newbie to iOS and my experience is only with iOS 6 & XCode 4.x. My App is iOS 6 only.
Has anyone successfully ported MGSplitViewController to the latest iOS & XCode?
I'd be keen to re-publish the MGSplitViewController for anyone else who comes up against this if I can get it working.
So far I've created a storyboard with a UIViewController (subclassed to MGSplitViewController) as the "Initial View Controller". A Navigation Controller - Table View Controller paid as the (subclassed to RootViewController) Another UIViewController (subclassed to DetailViewController) with toolbar, bar buttons etc.
There's no segues between the these 3. App delegate code looks like this:
@synthesize window, splitViewController, detailViewController, rootNavigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Remove the status bar
[[UIApplication sharedApplication] setStatusBarHidden:YES];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPad" bundle:nil];
splitViewController = (MGSplitViewController *) self.window.rootViewController;
rootNavigationController = [storyboard instantiateViewControllerWithIdentifier:@"masterNavigationController"];
detailViewController = [storyboard instantiateViewControllerWithIdentifier:@"detailViewController"];
detailViewController.splitController = splitViewController;
splitViewController.masterViewController = rootNavigationController.topViewController;
splitViewController.detailViewController = detailViewController;
splitViewController.delegate = detailViewController;
[rootNavigationController.topViewController performSelector:@selector(selectFirstRow) withObject:nil afterDelay:0];
[detailViewController performSelector:@selector(configureView) withObject:nil afterDelay:0];
if (NO) { // whether to allow dragging the divider to move the split.
splitViewController.splitWidth = 15.0; // make it wide enough to actually drag!
splitViewController.allowsDraggingDivider = YES;
}
}
return YES;
}
Am I on the right track here?
Upvotes: 1
Views: 761
Reputation: 1277
I ended up not needing this after all so didn't complete the port to iOS 6. However to save anyone else going through the effort I did to get as far as I did I'm posting a link to my web site where you can download my effort and continue the work.
Here's my effort at porting, use at your own risk!
Upvotes: 1