0
這裏的工作是什麼,我在我的AppDelegate
setTitleTextAttributes不NSForegroundColorAttributeName
self.tabBarController.delegate = self;
NSDictionary *unSelectedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[Utility primaryColor], NSForegroundColorAttributeName, nil];
NSDictionary *selectedAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName, nil];
[[UITabBarItem appearance] setTitleTextAttributes:unSelectedAttributes
forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:selectedAttributes
forState:UIControlStateSelected];
做什麼,這是我的firstViewController:
[[UINavigationBar appearance] setBarTintColor:[Utility primaryColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
UITabBar * tabBar = self.tabBarController.tabBar;
UIImage *tabImage = [UIHelper makeImageWithSizeAndColor:[Utility primaryColor] : CGSizeMake(tabBar.frame.size.width/2, tabBar.frame.size.height)];
tabImage = [tabImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tabBar.selectionIndicatorImage = [UIHelper makeImageWithSizeAndColor:[Utility primaryColor] : CGSizeMake(tabBar.frame.size.width/tabBar.items.count, tabBar.frame.size.height)];
我的標籤正在改變顏色,但文本保持白色和灰色。它不會根據setTitleTextAttributes
改變顏色。
我認爲'UITextAttributeTextColor'已被棄用。但是,我確定我會試一試。 – user1324887
與我正在做的一樣。無論如何試過它,不起作用 – user1324887
它的工作。我剛剛檢查過。 – Nilesh