Objective-C: Custom TabBar UITabBarController
I have been searching for a way to customize the UIKit's UITabBarController. I would like to change the background image and selected tint color to follow the design from our creative team. It seems as though the backg开发者_JAVA百科round color can be altered as described here Changing Tint / Background color of UITabBar
However, I have not found a way to change the background to an image and the default 'blue' tint to another color. There are many apps in the appstore which use custom tabbars like so:
http://itunes.apple.com/th/app/project-noah/id417339475?mt=8
Please help. Thank you.
Its not UITabbarController in this link
http://itunes.apple.com/th/app/project-noah/id417339475?mt=8
its a UIToolbar.
you can do it by creating a category for UIToolBar
@interface UIToolBar(CustomImage)
- (void)drawRect:(CGRect)rect;
@end
@implementation UIToolbar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"imageToolbar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[super drawRect:rect];
}
@end
精彩评论