码迷,mamicode.com
首页 > 其他好文 > 详细

使用系统UITabbarItem自定义图片显示原本颜色和自定义文字颜色

时间:2015-04-12 22:21:19      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

。。。。。。

 

ThirdViewController *thirdVC = [[ThirdViewControlleralloc]initWithTitle:@"搜索信息"];

    //设置tabbarItem 的图片显示原图颜色;

    thirdVC.tabBarItem = [[UITabBarItemalloc]initWithTitle:@"搜索"image:[[UIImageimageNamed:@"login_usernick"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImageimageNamed:@"login_usernick_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

    

    //一句话改变图片和文字的颜色均为红色选中时候

//    [[UITabBar appearance]setTintColor:[UIColor redColor]];

    

//只是设置TabBarItem的字体颜色

    [[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorblackColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateNormal];

    [[UITabBarItemappearance] setTitleTextAttributes:[NSDictionarydictionaryWithObject:[UIColorredColor] forKey:NSForegroundColorAttributeName] forState:UIControlStateSelected];

    

    

    RootNavgationController*nav3 = [[RootNavgationControlleralloc]initWithRootViewController:thirdVC];

    NSArray *VCs= [NSArray arrayWithObjects:nav1,nav2,nav3, nil];

    tabControl.viewControllers = VCs;

 

    self.window.rootViewController = tabControl;

使用系统UITabbarItem自定义图片显示原本颜色和自定义文字颜色

标签:

原文地址:http://www.cnblogs.com/zhujin/p/4420476.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!