iPhone:Tabbar hides when pushing from TableView to UIViewController

Posted by user187532 on Stack Overflow See other posts from Stack Overflow or by user187532
Published on 2010-05-05T14:13:45Z Indexed on 2010/05/05 14:18 UTC
Read the original article Hit count: 418

Filed under:

Hello all,

I have four Tab bar items in a Tab bar which is being bottom of the view where i have the TableView. I am adding Tab bar and items programmatically (Refer below code) not through I.B. Click on first three Tab bar items, will show the data in the same TableView itself. But clicking on last Tab bar items will push to another UIViewcontroller and show the data there. The problem here is, when i push to the viewController when clicking on last Tab bar item, main "Tab bar" is getting removed.

Tab bar code:

UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 376, 320, 44)];
item1 = [[UITabBarItem alloc] initWithTitle:@"First Tab" image:[UIImage imageNamed:@"first.png"] tag:0];
item2 = [[UITabBarItem alloc] initWithTitle:@"Second Tab" image:[UIImage imageNamed:@"second.png"] tag:1];
item3 = [[UITabBarItem alloc] initWithTitle:@"Third Tab" image:[UIImage imageNamed:@"third.png"] tag:2];
item4 = [[UITabBarItem alloc] initWithTitle:@"Fourth Tab" image:[UIImage imageNamed:@"fourth.png"] tag:3];
item5 = [[UITabBarItem alloc] initWithTitle:@"Fifth Tab" image:[UIImage imageNamed:@"fifth.png"] tag:4];
NSArray *items = [NSArray arrayWithObjects: item1,item2,item3,item4, item5, nil];
[tabBar setItems:items animated:NO];
[tabBar setSelectedItem:item1];
tabBar.delegate=self;
[self.view addSubview:tabBar];

Push controller code clicking from last Tab bar item:

myViewController = [ [MyViewController alloc] initWithNibName:@"MyView" bundle:nil];
        myViewController.hidesBottomBarWhenPushed=NO;
        [[self navigationController] pushViewController:myViewController animated:NO];

I am not seeing bottom Tab bar when i push my current TableView to myViewController. I am seeing full screen view there. I want to see bottom Tab bar always when every tab item clicked. What might be the problem here? Could someone who come across this issue, please share your suggestion to me?

Thank you.

© Stack Overflow or respective owner

Related posts about iphone