TabBarController and SplitViewController

Faser picture Faser · Oct 31, 2011 · Viewed 9.6k times · Source

i want my splitviewController to be displayed in within a TabBarController. Unfortunately, I firstly decided to just have a SplitViewController and chose apple's template. Now i am in the inconvenient position not knowing how to add it to a tab bar.

I tried several stuff that was explained here on StackOverflow but the best result was a black screen with a tab bar below it :-(

I am just struggling to find a nice and simple way.

Code of my Appdelegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
// Override point for customization after application launch.
// Add the split view controller's view to the window and display.
self.window.rootViewController = self.splitViewController;
[self.window makeKeyAndVisible];

NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentFolderPath = [searchPaths objectAtIndex: 0];
self.rootViewController.directoryPath = documentFolderPath; 

NSURL *docUrl = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
if ([docUrl isFileURL]) {
    NSString *path = [docUrl path];
    self.detailViewController.currentFilePath = path;
    [self.detailViewController setDetails:path newFile:FALSE];
}
return YES;

Answer

3lvis picture 3lvis · Nov 4, 2011

You should check IntelligentSplitViewController is everything you need!

Adding some controllers and design you can end with something like this:

Screenshot of an iPad app using IntelligentSplitViewController

PS: I've actually have an app in the App Store using this controller so go head!