iphone - How to get a fully transparent TabBar in UITabBarController -
this question has answer here:
- uitabbar transparent 1 answer
i have spent last few hours trying tabbar in uitabbarcontroller transparent (clear background). use custom subclass of uitabbarcontroller , managed change tintcolor, alpha, background color remains 1 defined in ib. help, i'm getting crazy...
here 1 way accomplish that.
cgrect frame = cgrectmake(0.0, 0.0, 320, 48);//setting frame. mytabview = [[uiview alloc] initwithframe:frame];//making tab view // not supported on ios4 uitabbar *tabbarr = [self.tabbar tabbar]; if ([tabbarr respondstoselector:@selector(setbackgroundimage:)]) { // set instance [tabbarr setbackgroundimage:[uiimage imagenamed:@"hot-1.png"]]; // set // [[uitabbar appearance] setbackgroundimage: ... } else { // ios 4 code here //[tabbarr setbackgroundcolor:c]; } //[mytabview setbackgroundcolor:c];//setting color of tabar. [mytabview setalpha:0.8];//setting alpha of tabview. [[self.tabbar tabbar] insertsubview:mytabview atindex:0];//inserting tab subview.
and here link tutorial found useful in changing tab bar's background. can play around code , costomize liking.
http://ios-blog.co.uk/tutorials/how-to-customize-the-tab-bar-using-ios-5-appearance-api/
edit:
as far setting background color of tabbar transparent or clear color, have 2 ways. 1 image explained , didn't like. other 1 set background of tabbar in supper view. along following line.
tabbar.superview.backgroundcolor = [uicolor clearcolor];
this way reach behind tabbar , change black background whatever want.
edit 1:
sorry delay in adding solution ios 7. below method need change background color of tabbar in ios 7.
just add following line of code inside viewdidload
method , magic.
[self.tabbarcontroller.tabbar setbackgroundcolor:[uicolor greencolor]];
hope helps.:)
Comments
Post a Comment