您的位置:首页 > 产品设计 > UI/UE

【UI-基础】改变UITabBarItem图片的颜色及文字

2015-09-08 10:18 381 查看
UIImage* tabBarBackground = [UIImage imageNamed:@"biaoqian.png"];

[[UITabBar appearance] setBackgroundImage:tabBarBackground];//设置背景,修改颜色是没有用的

[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tm.png"]];

[[UITabBar appearance] setShadowImage:[UIImage imageNamed:@"tm.png"]];//隐藏那条黑线

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColorgrayColor], UITextAttributeTextColor,nil] forState:UIControlStateNormal];

UIColor *titleHighlightedColor = [UIColor colorWithRed:198/255.0 green:59/255.0 blue:82/255.0 alpha:1.0];

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:titleHighlightedColor, UITextAttributeTextColor,nil]forState:UIControlStateHighlighted];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: