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

  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];

posted @ 2015-09-08 10:18  冷雨丶  阅读(365)  评论(0编辑  收藏  举报