tabBarController.tabBar.barTintColor = [UIColor blackColor];
// this will give selected icons and text your apps tint color
tabBarController.tabBar.tintColor = appTintColor; // appTintColor is a UIColor *
2)設置tabBarItem文本外觀要覆蓋每壹個狀態:[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:10.0f],
NSForegroundColorAttributeName : appTintColor
} forState:UIControlStateSelected];
// doing this results in an easier to read unselected state then the default iOS 7 one
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-Bold" size:10.0f],
NSForegroundColorAttributeName : [UIColor colorWithRed:.5 green:.5 blue:.5 alpha:1]
} forState:UIControlStateNormal];
2. 這個工作要在著色的標簽欄不活躍的項目UITabBarItem *item = [self.tabBar.items objectAtIndex:1];
//這裏妳需要用妳想要的顏色的圖標,因為它會被渲染,因為它是item.image = [[UIImage imageNamed:@"unselected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//這個圖標選中的標簽,它會得到有色定義見self.tabBar.tintColor
item.selectedImage = [UIImage imageNamed:@"selected.png"];
3. 使用self.tabBarController.tabBar.barStyle = UIBarStyleBlack;使標簽欄黑色
4. 埃德的答案是完美的,但補充壹點。 的TabBar是默認的半透明使用TabBar下受到的觀點的顏色(即的ViewController的視圖的顏色影響的TabBar外觀)。 所以我設置下面的代碼不會受到影響。self.tabBarController.tabBar.translucent = false;
連同Ed的這裏的答案是代碼了。self.tabBarController.tabBar.barTintColor = [UIColor blackColor];
self.tabBarController.tabBar.translucent = false;
self.tabBarController.tabBar.tintColor = [UIColor blueColor];
5. 妳試試吧for (UITabBarItem *item in self.tabBarController.tabBar.items) {
item.image = [[UIImage imageNamed:@"youimage.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
nil] forState:UIControlStateNormal];
item.selectedImage = [UIImage imageNamed:@"youimage.png"];
}