Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add tab bar controllers to the root view of the split view controller application

enter image description here

I am very new to the iPad UISplitViewController.

I need to add a tab bar containing 3 tabs at the bottom of the master view / left view. I have a different View Controller for each of the 3 tabs. I haven't found any other examples of Tab bars being used in split view based applications.

Where do I insert a tab bar controller for displaying at the bottom of the the root view?

How do I establish a connection so that when I select a table cell, the detailItem info gets displayed in the Detail View? Tab bar was added to the Root View in IB. Should I be adding it programmatically instead?

like image 620
Ranga Avatar asked Dec 30 '25 18:12

Ranga


1 Answers

in your app delegate add tabbar controller then add your view controllers to tabbar controller and set the window rootview controller to tabbar controller.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
 self.tabbar=[[UITabBarController alloc] init];

   self.vc1 = [[vc1 alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
   // do the same to other VCs
    self.tabbar.viewControllers=[NSArray arrayWithObjects:vc1,vc2,vc3,vc4, nil];


self.window.rootViewController = self.tabbar;

[self.window makeKeyAndVisible];
return YES;

}

i hope it helps :-)

like image 66
Hashmat Khalil Avatar answered Jan 02 '26 06:01

Hashmat Khalil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!