简体   繁体   中英

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 background 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM