FDControlTabbar
- 这是一种快捷的 TabBarItem 样式设置方法,支持主流 APP 样式的定制化功能。
内容
此控制器的独特功能是什么
- UITabBarController 扩展,最小化代码侵入性。
- 支持 TabBar 中间凸起 Button 显示。
- 支持定制 UTabBarItem 动画效果。
- 支持定制 UITabBarItem 图片帧动画效果。
- 支持修改选中 UITabBarItem 背景颜色。
- 支持 UITaBarItem 小红点。
- 兼容 UITabBarController 的 api 使用方式。
支持什么样的 tabbar 样式
lottie
、KeyAnimation
、largeImageButton
、ImageArrayButton
、badge
要求
- iOS8.0 或更高版本
如何使用FDControlTabbar
-
安装
- 通过CocoaPods:
pod 'FDControlTabbar'
- 手动:
- 将
FDControlTabbar
文件夹拖入工程 - 引入头文件:
#import "FDControlTabbar.h"
- 将
- 通过CocoaPods:
-
代码示例
-
lottie格式
-
keyAnimation的用法
-
代码
Demo3ViewController* demo = [Demo3ViewController new]; demo.tabBarItem.title = @"Demo3"; //设置非选中图片 demo.tabBarItem.image = [UIImage imageNamed:@"tabBarBtn3_01"]; demo.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabBarBtn3_02"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; //tabBarItem选中背景色. demo.tabBarItem.selectedBgColor = [UIColor darkGrayColor]; CAKeyframeAnimation *animation = [CAKeyframeAnimation animation]; animation.keyPath = @"transform.scale"; animation.values = @[@1.0,@1.3,@0.9,@1.15,@0.95,@1.02,@1.0]; animation.duration = 1; animation.calculationMode = kCAAnimationCubic; demo.tabBarItem.animation = animation;
-
-
中间大图按钮的用法
- 代码
UITabBarController* tabCtl = [UITabBarController new]; //设置tabBar透过 tabCtl.tabBar.translucent = YES; //设置tabBarItem选中后image的合成颜色. tabCtl.tabBar.tintColor = [UIColor blueColor]; //创建中间plusButton tabCtl.plusButton = [UIButton new]; [tabCtl.plusButton setImage:[UIImage imageNamed:@"+"] forState:UIControlStateNormal]; //调整位plusButton的image向上拉伸20达到凸起到tabbar外. tabCtl.plusButton.imageEdgeInsets = UIEdgeInsetsMake(-30, 0, 0, 0); [tabCtl.plusButton addTarget:self action:@selector(onPlusButton) forControlEvents:UIControlEventTouchUpInside];
-
图片数组的用法
- 代码
Demo4ViewController* demo = [Demo4ViewController new]; demo.tabBarItem.title = @"Demo4"; //设置非选中图片 demo.tabBarItem.image = [UIImage imageNamed:@"tab_home_normal"]; //设置选中图片 demo.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab_home_00"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; NSMutableArray* list = [NSMutableArray new]; for (int index = 0; index <= 50; index ++) { NSString* name = [NSString stringWithFormat:@"tab_home_%02d", index]; UIImage* image = [UIImage imageNamed:name]; [list addObject:image]; } //设置选中帧动画图片 demo.tabBarItem.animationImages = [list copy];
-
给tabbaritem加脚注提醒
- 代码
Demo3ViewController* demo = [Demo3ViewController new]; demo.tabBarItem.title = @"Demo3"; //tabBarItem dot显示 demo.tabBarItem.isShowDot = YES; demo.tabBarItem.dotColor = [UIColor blueColor];
-
Demo
- 这里展示一下Demo效果,供参考。