i use uitabbar
, uitabbaritems
it. can set badge value uitabbaritem
before assigning tabbaritem
tabbar
. problem not able update badge value of tabbaritem
.
here code able set badge value initially:
// array of tabbaritems nsmutablearray * tabs = [[nsmutablearray alloc] init]; for(iterates few times) { [tabs addobject:[[uitabbaritem alloc] initwithtitle:firstname image:nil tag:i]]; // set tabitem's property [(uitabbaritem *)[tabs objectatindex:i] setfinishedselectedimage:[self convertimage:iconimage tosize:cgsizemake(iconwidth, tab_icon_height)] withfinishedunselectedimage:[self convertimage:iconimage tosize:cgsizemake(iconwidth, tab_icon_height)]]; [[tabs objectatindex:0] setbadgevalue:[nsstring stringwithformat:@"%d", 2]]; } // setting items of uitabbar [self.chattabbar setitems:tabs];
here, try update badge value. happens if nslog
new badge value shows updated value see no change in ui.
[[self.chattabbar.items objectatindex:0] setbadgevalue:[nsstring stringwithformat:@"%d", 1]];
try it:
uiviewcontroller *carrinhovc = [self.tabbarcontroller.viewcontrollers objectatindex:0]; carrinhovc.tabbaritem.badgevalue = [nsstring stringwithformat:@"%d", 1];
carrinhovc uiviewcontroller want update badge value inside tabbar.
Comments
Post a Comment