iphone - Tab Bar Controller Customization and "More" Problem -
here's problem:
i have tab bar controller customized tab item highlights yellow instead of default blue. what's wrong "more" item comes because have many tab items (removing them not option), , "more" still blue.
i used classes got internet implement customization. here code:
// uitabbar+colorextensions.m
@implementation uitabbar (colorextensions) - (void)recoloritemswithcolor:(uicolor *)color shadowcolor:(uicolor *)shadowcolor shadowoffset:(cgsize)shadowoffset shadowblur:(cgfloat)shadowblur { cgcolorref cgcolor = [color cgcolor]; cgcolorref cgshadowcolor = [shadowcolor cgcolor]; (uitabbaritem *item in [self items]) if ([item respondstoselector:@selector(selectedimage)] && [item respondstoselector:@selector(setselectedimage:)] && [item respondstoselector:@selector(_updateview)]) { cgrect contextrect; contextrect.origin.x = 0.0f; contextrect.origin.y = 0.0f; contextrect.size = [[item selectedimage] size]; // retrieve source image , begin image context uiimage *itemimage = [item image]; cgsize itemimagesize = [itemimage size]; cgpoint itemimageposition; itemimageposition.x = ceilf((contextrect.size.width - itemimagesize.width) / 2); itemimageposition.y = ceilf((contextrect.size.height - itemimagesize.height) / 2); uigraphicsbeginimagecontext(contextrect.size); cgcontextref c = uigraphicsgetcurrentcontext(); // setup shadow cgcontextsetshadowwithcolor(c, shadowoffset, shadowblur, cgshadowcolor); // setup transparency layer , clip mask cgcontextbegintransparencylayer(c, null); cgcontextscalectm(c, 1.0, -1.0); cgcontextcliptomask(c, cgrectmake(itemimageposition.x, -itemimageposition.y, itemimagesize.width, -itemimagesize.height), [itemimage cgimage]); // fill , end transparency layer cgcontextsetfillcolorwithcolor(c, cgcolor); contextrect.size.height = -contextrect.size.height; cgcontextfillrect(c, contextrect); cgcontextendtransparencylayer(c); // set selected image , end context [item setselectedimage:uigraphicsgetimagefromcurrentimagecontext()]; uigraphicsendimagecontext(); // update view [item _updateview]; } } @end
and controller:
@implementation aatabbarcontroller - (void)viewdidload { [super viewdidload]; // put in background cgrect frame = cgrectmake(0.0, 0, self.view.bounds.size.width, 48); backgroundview = [[uiview alloc] initwithframe:frame]; [backgroundview setbackgroundcolor:[uicolor colorwithred:0.0 green:0.0 blue:0.0 alpha:0.1]]; [self.tabbar insertsubview:backgroundview atindex:0]; } -(void)dealloc { [backgroundview release]; [super dealloc]; } -(void)updatetabcolor:(uicolor *)color { // recolor tab bar [self.tabbar recoloritemswithcolor:color shadowcolor:[uicolor blackcolor] shadowoffset:cgsizemake(0.0f, -1.0f) shadowblur:3.0f]; } -(void)updatebackgroundcolor:(uicolor *)color { // update background color [backgroundview setbackgroundcolor:color]; } @end
does know should "more" tab item customized color?
that code looks similar code in this question. know you're asking different question here (the linked q asks "will app rejected" answer "yes"). nevertheless, you're using same private uitabbaritem methods, it's unlikely can give reliable answer.
Comments
Post a Comment