我知道這個主題已經有一些線程,但它們只部分解決了我的問題。 我設法定製moreNavigationController的導航欄的顏色和標籤顏色在這裏看到: 在iOS 7中自定義moreNavigationController
但我通過自定義,如果你的「編輯」,點擊右側足見其觀點得到了一些問題。這是它現在的樣子:
我想實現什麼?在白色
- 顏色做了的導航欄紅色
- 顏色爲紅色
我已經通過
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
得我在我的AppDelegate的UITabBarController參考圖標色彩 而且我還設置了此tabBarController的委託和委託方法- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers
也被調用。但從那裏我不能着色這三個控件。有人給我提示?
例如這樣的:
id modalViewCtrl = [[[tabBarController view] subviews] objectAtIndex:1];
if([modalViewCtrl isKindOfClass:NSClassFromString(@"UITabBarCustomizeView")] == YES)
((UINavigationBar*)[[modalViewCtrl subviews] objectAtIndex:0]).barTintColor = [UIColor redColor];
而且這樣的:
- (void)tabBarController:(UITabBarController *)controller willBeginCustomizingViewControllers:(NSArray *)viewControllers {
UIView *editView = [controller.view.subviews objectAtIndex:1];
UINavigationBar *modalNavBar = [editView.subviews objectAtIndex:0];
modalNavBar.tintColor = [UIColor redColor];
}
不只是沒有或崩潰的barTintColor,因爲它 「不能設置barTintColor上的UILabel」 。但我不太清楚如何檢索不同的控件來設置它們的顏色值。