在每个item所承载的viewcontroller.m文件中添加此方法(xcode6之后创建viewcontroller貌似没有这个方法了,自己加上去吧)
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.tabBarItem.title = @"通讯录";//设置tabar的标题
self.navigationItem.title= @"通讯录";//设置上导航的标题
self.title= @"通讯录";//两个标题一块设置self.tabBarItem.image = [UIImage imageNamed:@"wo.tiff"];//设置item的图片,这个是正常状态的,如果自己没设置点击状态的图片,系统默认点击后变蓝,可用
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"chat_pressed.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"chat_normal.png"]];设置点击和未点击状态的图片,也可以用
self.tabBar.tintColor = [UIColor orangeColor];改变点击之后的颜色变化
}
return self;
}