tags:

views:

61

answers:

0

I'm trying to create add a UITabBar in code to a view. I'm having a problem having the tab bar items work correctly. Here is what I have:

IntegratedTableViewController *integratedTableViewController = [[IntegratedTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
integratedTableViewController.title = @"Integrated";
integratedTableViewController.tabBarItem.image = [UIImage imageNamed:@"all.png"];


NSArray *items = [NSArray arrayWithObjects: integratedTableViewController.tabBarItem, nil];
[tabBar setItems:items animated:NO];

So everything loads and when I select the item, I'm calling didSelectItem correctly. The problem is that my IntegratedTableViewController is loading nothing. It's the one selected originally and even when I select it nothing loads. I've call the view other ways and it works, I just can't get it to work in my tab bar. So basically I can't get the integratedTableViewController to have data when it's preselected and when I select it.

Here is my didSelectItem method:

  • (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {

    if (item.tag == 1) { [self.view bringSubviewToFront:integratedTableViewController.view]; }

    } }