iOS 自定义TabBar

首先看看效果

iOS 自定义TabBar_第1张图片
效果图
参考 (BATabBarController)

点击获取DOME

pod 'QWTabBar'

实现思路

创建一个视图覆盖在系统的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 = @[@"首页",@"任务",@"动态",@"活动",@"我的"];

for(int i =0;i

设置角标

    [[QWTabBarController qwTabbarController].qwTabBar setBadge:122 index:4]; 

tabBarItem

@property (nonatomic, readonly, strong) NSMutableArray  *tabBarItems;

标题

@property (nonatomic, copy) NSArray  *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;

当前选中的下标

@property (nonatomic, assign) NSInteger selectIndex;

当前选中的 TabBar

 @property (nonatomic, strong) QWTabBarItem *tabBarItem;

 @property (nonatomic, weak) id delegate;

创建方法

-(instancetype)initWithTitles:(NSArray  *)titles itemImages:(NSArray *)itemImgs selectImages:(NSArray *)selectImages;

设置角标

 -(void)setBadge:(NSInteger)count index:(NSUInteger)index;

你可能感兴趣的:(iOS 自定义TabBar)