首先看看效果

效果圖
參考 (BATabBarController)
pod 'QWTabBar'
實現(xiàn)思路
創(chuàng)建一個視圖覆蓋在系統(tǒng)的TabBar上面
NSMutableArray *array = [NSMutableArray arrayWithArray:@[@"UIViewController",@"UIViewController",@"UIViewController",@"UIViewController",@"TestViewController"]];
NSArray *imgArray = @[@"homePage",@"task",@"complaint",@"home_activity",@"me"];
NSArray *selectImageArray = @[@"homePage_select",@"task_select",@"complaint_select",@"home_activity_select",@"me_select"];
NSArray *titles = @[@"首頁",@"任務(wù)",@"動態(tài)",@"活動",@"我的"];
for(int i =0;i<array.count;i++)
{
UIViewController *vc = [[NSClassFromString(array[i]) alloc] init];
[array replaceObjectAtIndex:i withObject:vc];
}
self.viewControllers = array;
//覆蓋系統(tǒng)的tabBar
self.qwTabBar = [[QWTabBar alloc] initWithTitles:titles itemImages:imgArray selectImages:selectImageArray];
self.qwTabBar.delegate = self;
self.qwTabBar.tintColor = [UIColor orangeColor];
[self.tabBar addSubview:self.qwTabBar];
設(shè)置角標
[[QWTabBarController qwTabbarController].qwTabBar setBadge:122 index:4];
tabBarItem
@property (nonatomic, readonly, strong) NSMutableArray <QWTabBarItem *> *tabBarItems;
標題
@property (nonatomic, copy) NSArray <NSString *> *titles;
默認圖標 UIImage 類型 或者 NSString 類型
@property (nonatomic, strong) NSArray *itemImages;
選中圖標 UIImage 類型 或者 NSString 類型
@property (nonatomic, strong) NSArray *selectItemImages;
默認標題顏色
@property (nonatomic, strong) UIColor *defColor;
選中標題顏色
@property (nonatomic, strong) UIColor *tintColor;
當(dāng)前選中的下標
@property (nonatomic, assign) NSInteger selectIndex;
當(dāng)前選中的 TabBar
@property (nonatomic, strong) QWTabBarItem *tabBarItem;
@property (nonatomic, weak) id <QWTabBarDelegate>delegate;
創(chuàng)建方法
-(instancetype)initWithTitles:(NSArray <NSString *> *)titles itemImages:(NSArray *)itemImgs selectImages:(NSArray *)selectImages;
設(shè)置角標
-(void)setBadge:(NSInteger)count index:(NSUInteger)index;