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

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

2015-04-12 20:33 477 查看
。。。。。。

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐