已支持 Lottie 的依赖最新版本, 支持指定渲染模式
CYLTabBarController 1.99.20以上版本,已对 Lottie 的依赖版本, 进一步细化, 采用二分法: ObjC 和Swift版本,进行区分。ObjC指定 ~>2.5.3 , Swift版本指定>=4.0.0。CYLTabBarController 内部 , 可以根据依赖版本的不同,执行不同逻辑。同时保持API接口不变。
用法见GitHub Demo演示。
#pod 'CYLTabBarController', '~> 1.99.20' # 默认不依赖Lottie
#pod 'CYLTabBarController/LottieObjectiveC', '~> 1.99.20' # 依赖Lottie Objective-C库
#pod 'CYLTabBarController/LottieSwift', '~> 1.99.20' # 依赖Lottie Swift库
自我评估,已经可以满足大部分场景, 如需要更精细的 Lottie 版本区分, 请提issue, 描述清楚场景, 我排期开发。
注意LottieSwift支持的iOS版本最低为iOS13
s.ios.deployment_target = '13.0'
如果你的项目支持iOS12则不能使用Lottie Swift 版本。
你在选择时应该遵循这样的规则: Lottie OC版本仅在需要支持iOS12时引入,如果你的项目最低版本高于或等于iOS13那么你应该总是选择LottieSwift。
Lottie OC 对支持Lottie文件的暗黑模式有bug. 不再建议使用。
另外提一句, iOS26 未选中状态下的Label颜色,一直是总是 labelColor 也就是黑色或者白色, 无法通过appearance 自定义, 怀疑是Apple的bug, 或者是一个功能, 为了提高未选中时的辨识度。我没想到好的方案进行修复,调研了一下, 似乎大家都接受了这个bug? 如果你有好的方案,请提issue,社交媒体给我的留言,无法保证看见并回复。 issue为唯一反馈途径,谢谢理解。
添加接口lottie动画的渲染模式可以从外部指定 (默认渲染模式是fit) 增加didLayoutSubViewsBlock, 扩大PlusButton可点击面积, 解决iOS15有时候tabbar会变透明的问题;([bug]:iOS15在切换到某些vc后有可能出现TabBar变透明的情况 #574) reloadTabBarItemsWithAttributes; (关联 issue 动态更新 tabbarItem 的 icon 跟 title #303)
CYLTabBarController 现已支持 iOS26 上实现以下效果, 请更新至版本1.99.4以上版本:
Preview of the latest version 1.99.4 on iOS 26+
CYLTabBarController 现已支持 iOS26 上实现以下效果, 请更新至版本1.99.3以上版本:
- ✅同时展示 Lottie动画与液态玻璃效果;
- ✅支持将加号➕按钮,展示在液态玻璃效果上,并居中展示。保留 CYLTabBarController 旧版本的所有加号按钮逻辑。仅增加玻璃遮罩效果;
- ✅未使用私有API实现液态玻璃,可通过代码静态扫描,Apple 审核过审安全;
- ✅采用纯原生的液态玻璃效果,支持 iOS 系统设置对液态玻璃属性的全部修改操作;
- ✅企业生产环境级别开源解决方案;
- ✅对于已经集成 CYLTabBarController 的开发者友好,升级适配开发难度, 代码修改低于10行,升级总时长低于1小时;
- ✅不依赖UI兼容模式, iOS27 过审友好;
- ✅不依赖UI兼容模式, 实现扁平风格UI, iOS27 过审友好;
即刻访问 这里 ,了解更多:
CYLTabBarController v1.29.0版本 修复分割线和Lottie动画播放异常等bugs
今天把 CYLTabBarController 更新到1.29.0, 修了几个issue, 主要是顶部导航栏, 主要修复的功能:
- TabBar 自定义分割线
- 隐藏 TabBar 分割线的方法
将更新的代码贴一下:
// NO.1,using Image note:recommended.推荐方式
// set the bar shadow image
// without shadow : use -[[CYLTabBarController hideTabBarShadowImageView] in CYLMainRootViewController.m
if (@available(iOS 13.0, *)) {
UITabBarItemAppearance *inlineLayoutAppearance = [[UITabBarItemAppearance alloc] init];
// set the text Attributes
// 设置文字属性
[inlineLayoutAppearance.normal setTitleTextAttributes:normalAttrs];
[inlineLayoutAppearance.selected setTitleTextAttributes:selectedAttrs];
UITabBarAppearance *standardAppearance = [[UITabBarAppearance alloc] init];
standardAppearance.stackedLayoutAppearance = inlineLayoutAppearance;
standardAppearance.backgroundColor = [UIColor cyl_systemBackgroundColor];
standardAppearance.shadowImage = [[self class] imageWithColor:[UIColor cyl_systemGreenColor] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1)];
self.tabBar.standardAppearance = standardAppearance;
} else {
// Override point for customization after application launch.
// set the text Attributes
// 设置文字属性
UITabBarItem *tabBar = [UITabBarItem appearance];
[tabBar setTitleTextAttributes:normalAttrs forState:UIControlStateNormal];
[tabBar setTitleTextAttributes:selectedAttrs forState:UIControlStateSelected];
// // This shadow image attribute is ignored if the tab bar does not also have a custom background image.So at least set somthing.
[[UITabBar appearance] setBackgroundImage:[[UIImage alloc] init]];
[[UITabBar appearance] setShadowImage:[[self class] imageWithColor:[UIColor cyl_systemGreenColor] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1)]];
}
可以使用:
v1.29.0 更新了内部实现, 兼容了 iOS13+ ,和 iOS13- 版本.
-[[CYLTabBarController hideTabBarShadowImageView]
其中重要的部分在于找到分割线对应的 View, 实现方法如下:
- (UIImageView *)cyl_tabShadowImageView {
if (@available(iOS 10.0, *)) {
//iOS10及以上这样获取ShadowImageView:
UIView *subview = [self cyl_tabBackgroundView];
if (!subview) {
return nil;
}
NSArray<__kindof UIView *> *backgroundSubviews = subview.subviews;
//iOS13系统backgroundSubviews.count > 1可行,12及以下就不可行了
if (backgroundSubviews.count >= 1) {
for (UIView *subview in backgroundSubviews) {
if (CGRectGetHeight(subview.bounds) <= 1.0 ) {
return (UIImageView *)subview;
}
}
}
} else {
//iOS9这样获取ShadowImageView:
for (UIView *subview in self.subviews) {
if (CGRectGetHeight(subview.bounds) <= 1.0 ) {
return (UIImageView *)subview;
}
}
}
return nil;
}
详情参见 #423 issue.
fix issues: #431 #436 #492 #423
[CN]一行代码支持Lottie动画TabBar样式 [EN] It only needs one line of code to have an animated TabBar with Lottie.
[CN]一行代码支持Lottie动画TabBar样式 [EN] It only needs one line of code to have an animated TabBar with Lottie. 详情见:https://github.com/ChenYilong/CYLTabBarController/issues/341
Add new API to remove PlusButton dynamically
增加API,支持动态移除PlusButton
[work-arounds]compatible for iPhoneX for issue #312
v1.17.21 [work-arounds]compatible for iPhoneX for issue #312
work-arounds 方案,解决 iOS12.1上,iPhoneX 位置跳动的问题。
fix iPad tabbar item select bug
修复iPad上,如果有PlusViewController 后 tabbar item选择异常的问题











