I'm building a universal iOS app and the iPad version uses a SplitViewController. In the popover view, I have a UITabBarController with two buttons. When it runs on the iPhone, the TabBar buttons correctly stretch to fill the entire width of the view...
...but on the iPad, in the popover view, the buttons don't stretch to fill the entire width...
I'm creating the UITabBarController programmatically...
InspectionTabBarViewController *inspectionTabBarVC;
InspectionListViewController *inspectionListVC;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
inspectionListVC = [[InspectionListViewController alloc] initWithSunday:NO];
inspectionListVC.managedObjectContext = self.managedObjectContext;
UINavigationController *calendarNavVC = [[UINavigationController alloc] initWithRootViewController:inspectionListVC];
calendarNavVC.title = @"Calendar";
InspectionMapViewController *mapViewVC = [[InspectionMapViewController alloc] initWithNibName:@"InspectionMapView_iPhone" bundle:nil];
UINavigationController *mapdNavVC = [[UINavigationController alloc] initWithRootViewController:mapViewVC];
mapdNavVC.title = @"Map";
inspectionTabBarVC = [[InspectionTabBarViewController alloc] init];
[inspectionTabBarVC addChildViewController:calendarNavVC];
[inspectionTabBarVC addChildViewController:mapdNavVC];
self.window.rootViewController = inspectionTabBarVC;
}
else
{
inspectionListVC = [[InspectionListViewController alloc] initWithSunday:NO];
UINavigationController *calendarNavVC = [[UINavigationController alloc] initWithRootViewController:inspectionListVC];
calendarNavVC.title = @"Calendar";
InspectionMapViewController *mapViewVC = [[InspectionMapViewController alloc] initWithNibName:@"InspectionMapView_iPad" bundle:nil];
UINavigationController *mapdNavVC = [[UINavigationController alloc] initWithRootViewController:mapViewVC];
mapdNavVC.title = @"Map";
inspectionTabBarVC = [[InspectionTabBarViewController alloc] init];
[inspectionTabBarVC addChildViewController:calendarNavVC];
[inspectionTabBarVC addChildViewController:mapdNavVC];
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController_iPad" bundle:nil];
UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
self.splitViewController = [[UISplitViewController alloc] init];
self.splitViewController.delegate = detailViewController;
self.splitViewController.viewControllers = [NSArray arrayWithObjects:inspectionTabBarVC, detailNavigationController, nil];
self.window.rootViewController = self.splitViewController;
inspectionListVC.detailViewController = detailViewController;
inspectionListVC.managedObjectContext = self.managedObjectContext;
detailViewController.detailViewControllerDelegate = inspectionListVC;
}
[self.window makeKeyAndVisible];
I also tried setting the autoResizeMask inside the InspectionTabBarViewController's loadView method using the following statement...
self.tabBar.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth;
...but that didn't work either. How can I get the UITabBar buttons to fill the entire width of of the view?
Thanks so much in advance for your help!