标签:
以下代码是在TabBarViewController的ViewControllers的其中一个ViewController的viewDidLoad中写的!!!
UIImage *image = [UIImage imageNamed:@"Heart"];
//item未选中状态时,image不使用tintColor的颜色
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
//添加tabbarItem
UITabBarItem *tabbarItem = [[UITabBarItem alloc] initWithTitle:@"育儿搜" image:image selectedImage:image];
//设置item未选中状态时,title的颜色
[tabbarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
self.tabBarItem = tabbarItem;
标签:
原文地址:http://www.cnblogs.com/bigzhanglei/p/5007858.html