隐藏表格视图单元格上的标签栏

时间:2011-04-18 06:12:18

标签: iphone objective-c

我隐藏tabbar有问题。 这是我的代码

//this created in the Delegate.m file 
-(void)HideTabBar
{
    mTabController.hidesBottomBarWhenPushed =YES;
}

//Now i want to this on the cell select Tab bar  must hide when it go to the map view (other view ) for that i use this but its working 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    JourneyAppDelegate * journey = (JourneyAppDelegate *)[[UIApplication sharedApplication]delegate];
    [journey HideTabBar];
}
But 

它的工作原理如何做到这一点

2 个答案:

答案 0 :(得分:0)

正如方法所示,它仅在将视图控制器推入堆栈时起作用。因此,不要试图将其隐藏在视图控制器(表视图所在的位置)中,只需添加该行即可 [mapController setHidesBottomBarWhenPushed: YES]无论您在何处创建地图控制器。

希望你理解我的工作。

答案 1 :(得分:0)

mTab​​Controller在推送示例之前不会被隐藏/隐藏:

//this created in the Delegate.m file 
-(void)HideTabBar
{
    mTabController.hidesBottomBarWhenPushed =YES;
    [self.navigationController pushViewController:IncomingViewController animated:YES];
}

//Now i want to this on the cell select Tab bar  must hide when it go to the map view     (other view ) for that i use this but its working 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   JourneyAppDelegate * journey = (JourneyAppDelegate *)[[UIApplication sharedApplication]delegate];
   [journey HideTabBar];
}

您需要在调用 pushViewController 之前将 hidesBottomBarWhenPushed 属性设置为要推送的UIViewController。