第一种
直接从tabBarController中获取指定index的tabBarItem,然后对其进行相关修改,比如修改image和title。
UITabBarItem *item0 = [self.tabBarController.tabBar.itemsobjectAtIndex:0];
item0.image = [[UIImageimageNamed:@"notepad"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
item0.selectedImage = [[UIImageimageNamed:@"notepad_selected"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
item0.title =@"好友";
第二种
新建一个baritem,然后将其设置给navigationContoller的barItem属性。
UITabBarItem *barItem = [[UITabBarItem alloc] initWithTitle:@""
image:[[UIImage imageNamed:@"notepad"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
tag:0];
[self.navigationController setTabBarItem:barItem];