I have a UINavigationController as the root view controller of an app.
At some point I need to push a UITabController with specific tabs.
Up to this point it all works.
However in the tab view controllers I can't access the UINavigationController navBar (to change title, tint, etc).
Here is how I push it:
SCTabController *TabController = [[SCTabController alloc] init];
[self.navigationController pushViewController:TabController animated:YES];
SCTabController is a subclass of UITabController with the following viewDidLoadMethod:
- (void)viewDidLoad {
[super viewDidLoad];
UIViewController *view1 = [[UIViewController alloc] init];
UIViewController *view2 = [[UIViewController alloc] init];
UIViewController *view3 = [[UIViewController alloc] init];
UIViewController *view4 = [[UIViewController alloc] init];
NSMutableArray *tabViewControllers = [[NSMutableArray alloc] init];
[tabViewControllers addObject:view1];
[tabViewControllers addObject:view2];
[tabViewControllers addObject:view3];
[tabViewControllers addObject:view4];
[self setViewControllers:tabViewControllers];
//can't set this until after its added to the tab bar
bankHomeViewController.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"Title1"
image:nil
tag:1];
view2.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"Title2"
image:nil
tag:2];
view3.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"Title3"
image:nil
tag:3];
view4.tabBarItem =
[[UITabBarItem alloc] initWithTitle:@"Title4"
image:nil
tag:4];
