2011-04-18 95 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

相關問題