Hi,
In my application I'm using a Navigation Controller to push one view that loads a Tab Bar Controller and a custom Navigation Bar as well. The problem is that the Tab Bar disappears below the bottom of the screen, and I don't know what's causing the problem.
If I load a simple Tab Bar in the next view, it positions itself correctly... but what I need is a Tab Bar Controller, and in that case the Tab Bar disappears below the bottom. I have tried changing the view and size properties of the Tab Bar, but that did not solve the problem.
I also realised that the images and text of the tabs don't show (I have set up the "favourites" and "contacts" images and text, and they are big enough and should be visible on the top side of the tab, but they are not).
Both tabs work perfectly, by the way.
There is an image here.
I load the Tab Bar with the following code:
- (void)viewDidLoad {
[super viewDidLoad];
myTabBarController = [[UITabBarController alloc] init];
SettingsViewController* tab1 = [[SettingsViewController alloc] init];
AboutViewController* tab2 = [[AboutViewController alloc] init];
NSArray* controllers = [NSArray arrayWithObjects:tab1, tab2, nil];
myTabBarController.viewControllers = controllers;
[self.view insertSubview:myTabBarController.view belowSubview:myNavigationBar];
}
It doesn't matter if I remove the Navigation Bar or not. I have tested using this instead:
[self.view addSubview:myTabBarController.view];
... forgetting about the Navigation Bar, but the Tab Bar still goes under the bottom.
I don't know if the problem is in one of my NIB files or in how I load the view (although I do this as I read in the Apple's SDK documentation). Any ideas?
Another question would be... do you know how could I change the title of my Navigation Bar when I select the second tab? I imagine I would have to do it in viewDidLoad in AboutViewController.m, would that be correct?
Thanks for you time!