Las*_*ang 7 objective-c uitabbarcontroller uitabbar ios
我当前的标签栏如下所示:

我的代码如下:
-(void)startTabBar{
self.tabBarController = [[UITabBarController alloc] init];
TAB_1 *tab_1 = [[TAB_1 alloc]init];
TAB_2 *tab_2 = [[TAB_2 alloc]init];
TAB_3 *tab_3 = [[TAB_3 alloc]init];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor], NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
NSArray* controllers = [NSArray arrayWithObjects:tab_1,tab_2, tab_3, nil];
self.tabBarController.viewControllers = controllers;
self.window.rootViewController = self.tabBarController;
}
Run Code Online (Sandbox Code Playgroud)
我想做的是:
普通标签:标签 标题应为黑色,但只有图标图像应为黑色.预期的标签应该是:

选定选项卡:选项卡标题应为红色,但只有图标图像应为红色.预期的标签应该是:

标签栏颜色:使整个tabBar颜色更透明,颜色相同
任何人都可以帮忙吗?
mic*_*den 22
这可以满足您的要求:
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
[[UITabBar appearance] setAlpha:0.25];
Run Code Online (Sandbox Code Playgroud)
在 iOS8 上的 Swift 中,它将是:
UITabBar.appearance().tintColor = UIColor.redColor()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19507 次 |
| 最近记录: |