1 .h文件
#import <UIKit/UIKit.h>
@class AKTabBar;
@interface AKTabBar : UITabBar
@end
2 .m文件
#import "AKTabBar.h"
@interface AKTabBar ()
@end
@implementation AKTabBar
- (void)layoutSubviews{
[super layoutSubviews];
self.tintColor = GROUND_COLOR(84, 165, 72, 1);
CGFloat tabBarButtonW = self.width/5;
CGFloat tabBarIndex = 0;
for (UIView *child in self.subviews){
Class class = NSClassFromString(@"UITabBarButton");
if ([child isKindOfClass:class]){
if (tabBarIndex == 2){
self.tintColor = [UIColor blueColor];//you can setting color in here
}
child.x = tabBarIndex * tabBarButtonW;
child.width = tabBarButtonW;
tabBarIndex++;
}
}
}