一、xxx.h
#import <UIKit/UIKit.h>
@interface main_Tab_bar : UITabBarController
@end
二、xxx.m
@implementation main_Tab_bar
- (void)viewDidLoad {
[super viewDidLoad];
//改变tabbar 线条颜色
CGRect rect = CGRectMake(0, 0, screenWidth, 1);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,
HexRGB(0xeeeeee).CGColor);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.tabBar setShadowImage:img];
//背景颜色
CGRect rect1 = CGRectMake(0, 0, screenWidth, 1);
UIGraphicsBeginImageContext(rect1.size);
CGContextRef context1 = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context1,
HexRGB(0xffffff).CGColor);
CGContextFillRect(context, rect);
UIImage *img1 = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.tabBar setBackgroundImage:img1];
}