2011-11-22 91 views
1

我想設置所有我的標籤欄的導航欄UIBarStyleBlack。如何設置「更多」標籤欄的編輯視圖的導航欄黑色?

我也可以做到這一點與此「更多」標籤欄:

tabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlack; 

的問題是,當你點擊它的頂部編輯按鈕,自定義標籤它提出了一個新的模態控制器與標準藍色導航欄,我無法設置它UIBarStyleBlack。

+0

發現此頁面[鏈接](http://runmad.com/blog/2010/01/coloring-fun-with-morenavigationcontroller-and-it/ ) – Rivera

+0

好像我可以捕捉實現此標籤欄的模式編輯視圖委託方法 - (void)tabBarController:(UITabBarController *)控制器willBeginCustomizingViewControllers:(NSArray *)viewControllers – Rivera

回答

3

該鏈接有一個輕微的hackie解決方案,涉及到何時會出現模態視圖。

Colouring fun with moreNavigationController

直到iOS5的+,使我們能夠做一個更清潔的方式。

+0

在主要應用程序中完成它並沒有被拒絕 - >工作正常。 – Till

+0

這不是真的那麼哈克。這並不像你在調整或使用私人API。無論如何,只是想評論一下,所有這些都可以通過UIAppearance在iOS 5及更高版本上完成。 – runmad

0

Sublcass UITabBarController並覆蓋這些方法:

- (void)tabBar:(UITabBar *)tabBar willEndCustomizingItems:(NSArray<UITabBarItem *> *)items changed:(BOOL)changed { 
    self.moreNavigationController.navigationBar.barStyle = UIBarStyleBlack; 
} 

- (void)tabBar:(UITabBar *)tabBar didBeginCustomizingItems:(NSArray<UITabBarItem *> *)items { 
    self.moreNavigationController.navigationBar.barStyle = UIBarStyleDefault; 
} 
相關問題