ipaduitabbarcontrolleriphone-sdk-3.2uisplitviewcontrolleruipopovercontroller

UISplitViewController in a TabBar ( UITabBarController )?


I am in kind of situation that I need to start with a tab based application and in that I need a split view for one or more tabs. But it seems that split view controller object can not be added to the tabbarController. (Although tabbar object can be added to the splitviewcontroller).

The problem can be seen otherways: I have a full screen in the left part I have a table view when any row is selected in the table a popover should come out pointing that row. Now when any row in the popover is selected the rows in this popover comes to the left under the selected row (only this row would be visible) and another popover comes out from the selected row. (Breadcrumb navigation type)

I think I am clear in what I explained. So guys any ideas or work arounds?

Please let me know if I am not clear in my question.

Thanks,

Madhup


Solution

  • I made a sample application. and found we can do it programmatically like:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
            NSMutableArray *array = [NSMutableArray array];
    
            NSMutableArray *tabArray = [NSMutableArray array]; 
    
            UISplitViewController *splitViewConntroller = [[UISplitViewController alloc] init];
    
            MainViewController *viewCont = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
            [array addObject:viewCont];
            [viewCont release];
    
            viewCont = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
            [array addObject:viewCont];
            [viewCont release];
    
    
    
    
            [splitViewConntroller setViewControllers:array];
    
            [tabArray addObject:splitViewConntroller];
    
            [splitViewConntroller release];
    
            array = [NSMutableArray array];
    
            splitViewConntroller = [[UISplitViewController alloc] init];
    
            viewCont = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
            [array addObject:viewCont];
            [viewCont release];
    
            viewCont = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
            [array addObject:viewCont];
            [viewCont release];
    
            [splitViewConntroller setViewControllers:array];
    
            [tabArray addObject:splitViewConntroller];
    
            [splitViewConntroller release];
    
            // Add the tab bar controller's current view as a subview of the window
            [tabBarController setViewControllers:tabArray];
    
            [window addSubview:tabBarController.view];
            [window makeKeyAndVisible];
    
            return YES;
        }
    

    Hope this helps.