您的位置:首页 > 其它

设置tabBar的背景图片,选中文字颜色

2017-02-25 18:34 561 查看
// 被废弃了 会有警告
self.tabBar.selectedImageTintColor = [UIColororangeColor];

// 最新的使用方法
NSMutableDictionary *textAttrs = [NSMutableDictionarydictionary];
textAttrs[NSForegroundColorAttributeName] =HWColor(123,123, 123);

NSMutableDictionary *selectTextAttrs = [NSMutableDictionary dictionary];
selectTextAttrs[NSForegroundColorAttributeName] = [UIColor orangeColor];

[childVc.tabBarItem setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
[childVc.tabBarItemsetTitleTextAttributes:selectTextAttrs forState:UIControlStateSelected];

// - 设置选中的图片 图片不被渲染
childVc.tabBarItem.selectedImage = [[UIImageimageNamed:selectedImage] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: