tabBarItem.badgeValue = @"NEW";
tabBarItem.badgeValue = @"ONE";
//修改标签栏的渲染颜色(选中后的颜色)
tabBarVC.tabBar.tintColor = [UIColor greenColor];
//设置默认选中的标签
tabBarVC.selectedIndex = 2;
//设置默认选中的视图控制器
tabBarVC.selectedViewController = thirdVC;
//给tabbar 来设置图片
tabBarVC.tabBar.backgroundImage = [UIImage imageNamed:@"320x49"];
#pragma mark -- UITabBarControllerDelegate
//询问标签是否可选中
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController NS_AVAILABLE_IOS(3_0)
{ return YES;}
//选中标签是触发
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
// NSLog(@"%s, %d", __FUNCTION__, __LINE__);
//如果选中第二个标签, 取消角标
if (101 == viewController.tabBarItem.tag) {
viewController.tabBarItem.badgeValue = nil;
}
}
//将要开始自定义标签视图控制器所管理的多个视图控制器(点击 more 中的 Edit 按钮)
- (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers NS_AVAILABLE_IOS(3_0)
{}
//完成标签栏的编辑时触发
- (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
{}