我当前的标签栏如下所示:
我的代码如下:
-(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],nil] forState:UIControlStateSelected]; NSArray* controllers = [NSArray arrayWithObjects:tab_1,tab_2,tab_3,nil]; self.tabBarController.viewControllers = controllers; self.window.rootViewController = self.tabBarController; }
我想做的是:
普通标签:标签标题应为黑色,但只有图标图像应为黑色.预期的标签应该是:
选定选项卡:选项卡标题应为红色,但只有图标图像应为红色.预期的标签应该是:
标签栏颜色:使整个tabBar颜色更透明,颜色相同
有人可以帮忙吗?
解决方法
这可以满足您的要求:
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]]; [[UITabBar appearance] setAlpha:0.25];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。