当我设置标签栏徽章时,标签栏的图片将消失! 而当我长按tabbaritem项目时会一直闪烁,并且无法恢复。
我第一次在系统中使用tabbar,希望得到帮助
NSArray * myviewControllers = [[NSArray alloc]initWithObjects:homeNav,ceshinav,msgNav,accNav, nil];
_rootContro = [[RootTabbarVC alloc]init];
[_rootContro setViewControllers:myviewControllers];
_rootContro.selectedIndex = 0;
self.window.rootViewController = _rootContro;
[self setUpTabbar];
[self.window makeKeyAndVisible];
UITabBarItem * it = [[UITabBarItem alloc]initWithTitle:@"..." image:[[UIImage imageNamed:@"tab_cat_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tab_cat_selected"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[it setImageInsets:UIEdgeInsetsMake(15, 20, 20, 20)];
[it setTitlePositionAdjustment:UIOffsetMake(0, -5)];
........The middle omit...........
NSArray *conversations = [[[EaseMob sharedInstance] chatManager] conversations];
NSInteger unreadCount = 0;
for (EMConversation *conversation in conversations) {
unreadCount += conversation.unreadMessagesCount;
}
UIViewController *vc = [self.viewControllers objectAtIndex:2];
if (unreadCount > 0) {
vc.tabBarItem.badgeValue = [NSString stringWithFormat:@"%d",unreadCount];
}else{
vc.tabBarItem.badgeValue = nil;
}