david_david
david_david

Reputation: 63

How to set a tabbarcontroller as rootview controller of UISplitViewController

my application needs the design similar to sybase ipad app which is here YouTube - Sybase Mobile Sales for SAP CRM on iPad

  1. How can I set a tabbarcontroller as rootview controller of UISplitViewController.

When I try to do this, 8 tabitems are displaying without "More" button. so its overlapping items title. And it will display More button if more than 8 tab items.

As it is using width 320, How to set only 5 tabs visible at a time.

sample

array = [[NSMutableArray alloc] init ];

for(int i=0; i <10; i++){

   TestTabController *cc = [[TestTabController alloc]init];
   UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:cc] ;
   [cc release];
   [array addObject:navController];
   [alertNavController release];
}
mytabBarController = [[UITabBarController alloc] init];
mytabBarController.viewControllers = array;

splitViewConntroller = [[UISplitViewController alloc] init];

[splitViewConntroller setViewControllers:[NSArray arrayWithObjects:mytabBarController, detailNavigationController, nil]];
  1. How can I set the detailController view as a controller in the tabbarcontrolller(rootController) at runtime -Any easy methods ?-.. We can see when user tap on a cell in the detailController view, it immediatly move to rootController and its detail will show in detailController

Any help/comments/suggestions would be grealy appreciated.

Upvotes: 0

Views: 1436

Answers (2)

Matt Long
Matt Long

Reputation: 24486

If you create a UISplitViewController based project from the project templates and then open the MainWindow.xib file in interface builder, you can then just drag a tab bar controller component from the Library palette onto the first view controller (the navigation controller) inside the split view controller. Then you should be able to just start adding view controllers to the new tab bar controller. You then just specify the view controllers you want to use for each of the tabs. I've created several projects this way and it works quite well.

Drag A Tab Bar Controller to Master Side View Controller

Of course, I'm assuming Xcode 3 here. I'm not completely sure if it's the same in Xcode 4 if that's what you're using.

Upvotes: 1

Macomatic
Macomatic

Reputation: 123

if I'm not mistaken, UITabBarController should always be the root view controller in all cases. So you're going the opposite way.

Upvotes: 0

Related Questions