自定义类TabBarVC 继承以UITabBarController
TabBarVC.h
#import <UIKit/UIKit.h>
@interface TabBarVC : UITabBarController
@end
TabBarVC.m
#import "TabBarVC.h"
@interface TabBarVC ()
@end
@implementation TabBarVC
- (void)viewDidLoad {
[super viewDidLoad];
NSArray *imageNames = @[@"首页-active",@"站点-active",@"地图-active",@"排名-active",@"设置-active"];
for (int i =0; i < self.tabBar.items.count; i++) {
UITabBarItem *item = self.tabBar.items[i];
UIImage *img = [UIImage imageNamed:imageNames[i]];
img=[img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//始终绘制图片原始状态,不使用Tint Color。
item.selectedImage = img;
}
}
故事版绑定TabBarVC类