Customize the background of Tab Bar in iPhone SDK

In iPhone application, you can change the background of tab bar by an image by following this code:

// customize the tab bar background
CGRect frame = CGRectMake(0, 0, 480, 49);
UIView *viewBackround = [[UIView alloc] initWithFrame:frame];
UIImage *imgBackground = [UIImage imageNamed:@"bg_tabbarview.png"];
UIColor *colorPattern = [[UIColor alloc] initWithPatternImage:imgBackground];
viewBackround.backgroundColor = colorPattern;
[colorPattern release];
[[self.tabBarController tabBar] insertSubview:viewBackround atIndex:0];
[viewBackround release];
// end custom tab bar

 

24 comments

  1. I thought this was a great blog post, and I largely agree with what you wrote. Even so I do have a very brief challenge… I’ve used an iPhone almost 3 years at the moment. Plus I have a short time ago move up to an iPhone 4. And even though I really like my iPhone ( for the most part), I completely loathe AT&T. I don’t want to have to jailbreak the iPhone to work with a better provider, yet if Apple stays in bed with AT&T much longer I’ll need to change to choosing the Android cell phone. My question for you is, do you believe Apple may have any sort of plans to widen the iPhone to additional providers any time soon? Mostly I would want to get one with legitimate 4G phone coverage! Many thanks!

    • phongnt

      You can see apple have everything. With Steve Job CEO, and now is Tim Cook i think apple still is number one about smart phone. I love apple.

  2. ;’` I am really thankful to this topic because it really gives up to date information `”,

  3. Identified you blog by using bing I must say I m fascinated along with your articles!