2011-04-18 66 views
0

我有问题隐藏tabbar。 这是我的代码隐藏表格视图单元格上的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 

它的工作如何能做到这一点

+0

@ user420220:在设置属性** hidesBottomBarWhenPushed **之后,您是否在推动视图控制器** mTab​​Controller **,因为在您按下它之前它不会隐藏。 – 2011-04-18 06:18:47

+0

但现在我的另一个问题来了。我添加这个tabbar一个arrowbar。我也隐藏这样 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {self.hidesBottomBarWhenPushed = YES; JourneyAppDelegate * journeyarrow =(JourneyAppDelegate *)[[UIApplication sharedApplication] delegate]; journeyarrow.tabBarArrow.hidden = YES;}它工作正常,当我来到这个页面,但当回到主视图的标签显示,但箭头栏不是.HOw可以slove thi – Harish 2011-04-18 07:43:16

回答

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]; 
} 

您需要设置hidesBottomBarWhenPushed属性设置为将要推你打电话pushViewController前的UIViewController。

+0

我加这\t \t self.hidesBottomBarWhenPushed = YES; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {self.hidesBottomBarWhenPushed = YES;}它的工作感谢您的答案。我得到的解决方案 – Harish 2011-04-18 06:32:41

+0

@ user420220:很高兴你解决了你的问题。 – 2011-04-18 06:34:56

+0

但现在我的另一个问题来了。我添加这个tabbar一个arrowbar。我也隐藏这样 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {self.hidesBottomBarWhenPushed = YES; JourneyAppDelegate * journeyarrow =(JourneyAppDelegate *)[[UIApplication sharedApplication] delegate]; \t \t journeyarrow.tabBarArrow.hidden = YES;}当我来到这个页面时,它工作正常,但当返回到主视图时,显示的标签,但箭头栏不是.HOw可以解决这个问题 – Harish 2011-04-18 06:54:01

0

正如方法所暗示的,它只能作为视图控制器被压入堆栈。因此,不要试图将其隐藏在表视图所在的视图控制器中,只需将行 [mapController setHidesBottomBarWhenPushed: YES]添加到您创建该映射控制器的任何位置。

希望你能理解我的工作。

+0

谢谢你的答案。我得到的解决方案 – Harish 2011-04-18 06:33:34

+0

但现在我的另一个问题来了。我添加这个tabbar一个arrowbar。我也隐藏这样 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {self.hidesBottomBarWhenPushed = YES; JourneyAppDelegate * journeyarrow =(JourneyAppDelegate *)[[UIApplication sharedApplication] delegate]; journeyarrow.tabBarArrow.hidden = YES;}当我来到这个页面时,它工作正常,但是当回到主视图时,标签显示,但箭头栏不显示。可以缓存 – Harish 2011-04-18 07:42:47

+0

您可以在地图中隐藏箭头栏查看控制器的'viewWillAppear:'方法,然后在'viewWillDisappear'中再次启用它:'理论上这应该起作用。 – 2011-04-18 12:40:52

相关问题