Tab bar as subview of view controller's top-level view; not drawn correctly
I have a tab bar controller that I have created programmatically, named TPastJourneyTabbar
. When I click on the table view and didSelectRowAtIndexPath:
is called, my tab bar class should get allocated and it should get added as subview of another class. I have done开发者_JAVA技巧 this using the follwing code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
TPastJourneyTabBar * tabbar = [[TPastJourneyTabBar alloc]init];
HGMovingAnnotationSampleViewController *detailViewController = [[HGMovingAnnotationSampleViewController alloc] initWithNibName:@"HGMovingAnnotationSampleViewController" bundle:nil];
[detailViewController.view addSubview:tabbar.view];
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
HGMovingAnnotationSampleViewController
is the class to which I am adding my tab bar as a subview. When I run my application, the tab bar is getting called but it is not getting called completely; i.e., the lower portion of the tab bar, where the title of the tab bar item is written, is not seen. How can I make the tab bar completely visible?
You have a design problem here. You shouldn't use a TabBar as a subview of nothing than the AppDelegate's window, as the Human Interface Guidelines states.
精彩评论