Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 922
Madhup Singh Yadav Avatar asked Mar 19 '10 05:03

Madhup Singh Yadav


People also ask

What is Tabbar controller?

The tab bar interface displays tabs at the bottom of the window for selecting between the different modes and for displaying the views for that mode. This class is generally used as-is, but may also be subclassed. Each tab of a tab bar controller interface is associated with a custom view controller.

How do I hide a Tabbar in Swift?

vc. hidesBottomBarWhenPushed = true should do the work. DO NOT manually show and hide the tabbar.


1 Answers

Using the interface builder, create a split view controller and a tab bar controller and link them to your outlets:

@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @property (nonatomic, retain) IBOutlet UISplitViewController *splitViewController; 

In your app delegate didFinishLaunchingWithOption, assign your split view controller to the tab bar controller:

splitViewController.tabBarItem = [[[UITabBarItem alloc] initWithTitle:@"Title" image:nil tag:0] autorelease]; NSArray *controllers = [NSArray arrayWithObjects:splitViewController,  /* other controllers go here */ nil]; tabBarController.viewControllers = controllers; [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; 

This will create a tab bar controller (with only 1 tab in this case), which is displayed correctly in all orientations.

like image 107
g_fred Avatar answered Oct 05 '22 23:10

g_fred