| 中文 | English |
|---|---|
[CN] 表示中文内容。 |
[CN] indicates Chinese content. |
[EN] 表示英文内容。 |
[EN] indicates English content. |
| 点此获取 QQ 群、Telegram 群交流信息。 | Join the QQ or Telegram groups. |
| 遇到使用问题,请先查阅 常见问题(docs/FAQ.md);bug 与新需求请提交 issue。 | For usage questions, see the FAQ (docs/FAQ.md) first; report bugs and feature requests as issues. |
本 README 完整提供中英文:标题成对出现,正文为中英文对照表格;下方「导航」为双语目录,「文档索引」列出 docs/ 中的全部文档,二者均由脚本自动生成。阅读方式见 docs/Bilingual-Documentation.md(#42)。 |
This README is fully bilingual: headings come in pairs and the text is in Chinese–English tables; "CONTENTS" below is a bilingual table of contents and "Documentation index" lists every document in docs/, both generated by a script. See docs/Bilingual-Documentation.md for how to read it (#42). |
贡献代码前请阅读 AGENTS.md:每个新功能都需要中英文双语文档(docs/ 中一份、README 中一份),截图与附件放在相应的 assets/ 目录。 |
Before contributing, read AGENTS.md: every new feature needs bilingual documentation (one in docs/, one in the README), with screenshots and attachments in the matching assets/ folder. |
Preview of the latest version on iOS 27+
| 中文 | English |
|---|---|
1.100.0 包含自 1.99.72 以来的全部改动。升级:CocoaPods Trunk 自 2026-12-02 起只读,1.100.0 不在 trunk 上:在 Podfile 中按 git tag 引用(见第一步)(Carthage:github "ChenYilong/CYLTabBarController" ~> 1.100.0)。注意 ~> 1.99.0 只会安装 1.99.x,不会升级到 1.100.0。下面是主要内容,每项的完整说明见本节之后的列表与链接的文档。 |
1.100.0 contains every change since 1.99.72. To upgrade: CocoaPods Trunk is read-only since 2026-12-02, so 1.100.0 is not on trunk: name it by git tag in the Podfile (see Step 1) (Carthage: github "ChenYilong/CYLTabBarController" ~> 1.100.0). Note that ~> 1.99.0 installs 1.99.x only and never 1.100.0. The highlights are below; each one is described in full in the list after this section and in the linked documents. |
✅ Tab 图标动画:Lottie、PAG、Rive、GIF(#782):四种动画用法相同,各自是独立子库(pod 'CYLTabBarController/PAG'、/Rive、/GIF),共用 CYLTabBarItemAnimation,Core 不依赖它们;同一个 TabBar 中可以只有部分 Tab 有动画。页面修改自己的 title 时,经典 TabBar 会新建 Tab 按钮,新按钮现在会重新获得该 Tab 的动画(#605)。先看 Tab 动画接入指南,再看 Tab 图标动画、PAG、Rive、GIF 与 部分 Tab 有动画。 |
✅ Tab icon animations: Lottie, PAG, Rive and GIF (#782): the four are used the same way, each is its own subspec (pod 'CYLTabBarController/PAG', /Rive, /GIF), they share CYLTabBarItemAnimation, and Core does not depend on them; a tab bar can animate only some of its tabs. When a page changes its own title, the classic tab bar makes a new tab button, and the new button now gets the tab's animation back (#605). Start with the tab icon animation quick start, then Tab icon animations, PAG, Rive, GIF and Animating some tabs. |
✅ 共用的动效 icon + title 组件:CYLAnimatedItemView(iOS 独立 pod 与模块 CYLAnimatedItem,import CYLAnimatedItem;Android 模块 cyltabbarcontroller-animateditem,包 com.cyl.animateditem),不依赖 CYLTabBarController。可继承:可播放任意动效的图标、标题、自带点击的附加图标,整体支持点击 / 长按 / 拖拽。默认只支持静态图片:与扁平样式一样用编译期 guard(CYL_ANIMATION_ENGINE_AVAILABLE)隔离,加入组件动效引擎(如 CYLAnimatedItemLottieSwift,不依赖 Core:CYLAnimatedItem 加它不会带入 TabBar)才带入引擎与动画库并播放动效,不用动效的项目不增加包体积;TabBar 的 Core 默认依赖 CYLAnimatedItem,CYLTabBarController/LottieSwift 等子库是 Core 加对应引擎,新增动画类型只改这里。见 接入文档。 倒计时样式(style = .countdown、startCountdown(),短信登录的「获取验证码」按钮,按结束时间计时,后台时间也计入):见文档。 只播放一次的动画结束后显示静态图片(showsImageWhenAnimationEnds,Android、鸿蒙、小程序;iOS 待完成;示例:鸿蒙 pages/AnimatedItemEnd、小程序 cyl-lottie 页面):见文档。 |
✅ A shared animated icon + title component: CYLAnimatedItemView (iOS: its own pod and module CYLAnimatedItem, import CYLAnimatedItem; Android module cyltabbarcontroller-animateditem, package com.cyl.animateditem), with no dependency on CYLTabBarController. Subclass it: an icon that plays any animation, a title, an accessory icon with its own tap, and tap / long press / drag on the whole view. Static images by default: like the FlatDesign tab bar, a compile-time guard (CYL_ANIMATION_ENGINE_AVAILABLE) brings the engine and the library only with a component engine (e.g. CYLAnimatedItemLottieSwift, no Core: with CYLAnimatedItem it brings no tab bar), so projects without animations stay small; the tab bar's Core depends on CYLAnimatedItem by default, and CYLTabBarController/LottieSwift and its siblings are Core plus the matching engine, so a new animation type changes only this. See the integration guide. Countdown style (style = .countdown, startCountdown(), the "Get code" button of an SMS login, counted by an end date so the background counts): Animated-Item.md. Still image after a play-once animation ends (showsImageWhenAnimationEnds, Android, HarmonyOS and the mini program; iOS to do; demos: HarmonyOS pages/AnimatedItemEnd, the mini program cyl-lottie page): see the guide. |
✅ 微信小程序的动效引擎 API:cyl-animated-item 与鸿蒙一致:cyl_player() 返回条目的 CYLAnimatedItemPlayer(play()、stopAtProgress(p)、speed、loops、supports…、isPlaying、onEnded(cb)、applyColors(colors)),drivesAnimationPlayback(默认 true;false 时由宿主通过播放器播放),restartToken(增长即重播)。 |
✅ Engine API of the WeChat Mini Program: cyl-animated-item follows the HarmonyOS contract: cyl_player() returns the item's CYLAnimatedItemPlayer (play(), stopAtProgress(p), speed, loops, supports…, isPlaying, onEnded(cb), applyColors(colors)), drivesAnimationPlayback (default true; false means the host plays through the player and the item applies no default rule), restartToken (plays again when it grows). Details: CrossPlatform/wechat-miniprogram-cyltabbar/README.md. |
✅ Android、React Native、Flutter 的动效引擎 API:Android CYLAnimatedItemView.animatedItemPlayer(play()、stopAtProgress(p)、speed、loops、supports…、isPlaying、progress、onEnded、applyColors(colors))、animationRestartToken、drivesAnimationPlayback(Android、RN、Flutter 视图默认 true,与 iOS、鸿蒙一致;自 2026-11-24 起 Android 默认由 false 改为 true,CYLTabBarItemButton 显式设为 false)、onAnimationLoaded / onAnimationFailed;RN <CYLAnimationView ref file options selected animationSpeed animationLoops animationRestartToken drivesAnimationPlayback iconSize tintColor onAnimationLoaded onAnimationFailed onAnimationEnd>,ref 提供 play()、stopAtProgress(p)、restart();Flutter CYLAnimationView(…, controller: CYLAnimationController()),参数与回调相同。;RN / Flutter 另有条目背景属性 itemBackgroundStyle(flat 默认 / liquidGlass)、itemBackgroundColor、itemCornerRadius(未设置:液态玻璃为胶囊、扁平为直角;常量 cylAnimatedItemCornerRadiusCapsule = 1000)、itemBorderWidth、itemBorderColor(Flutter 的样式为枚举 CYLAnimatedItemBackgroundStyle);所有平台新增 onResourceMissing(resource, reason):Android / iOS CYLAnimatedItemView.onResourceMissing、鸿蒙 onResourceMissing 属性、小程序事件 resourcemissing(detail {resource, reason})、RN 属性 onResourceMissing、Flutter CYLAnimationView.onResourceMissing;全局监听 CYLAnimationEngines.resourceMissingListener(Android、iOS)与 CYLAnimatedItemEngines.resourceMissingListener(鸿蒙);reason 为 not found、unreadable、decode failed、engine library missing 之一 |
✅ Engine API of Android, React Native and Flutter: Android CYLAnimatedItemView.animatedItemPlayer (play(), stopAtProgress(p), speed, loops, supports…, isPlaying, progress, onEnded, applyColors(colors)), animationRestartToken, drivesAnimationPlayback (false on the view, true on the React Native and Flutter views), onAnimationLoaded / onAnimationFailed; React Native <CYLAnimationView ref file options selected animationSpeed animationLoops animationRestartToken drivesAnimationPlayback iconSize tintColor onAnimationLoaded onAnimationFailed onAnimationEnd> with a ref offering play(), stopAtProgress(p), restart(); Flutter CYLAnimationView(…, controller: CYLAnimationController()) with the same parameters and callbacks. CYLAnimatedItemSource.parse reads # / ? options and is tested with CrossPlatform/animated-item-fixtures/source-options.json.; React Native and Flutter also take the item background props itemBackgroundStyle (flat default / liquidGlass), itemBackgroundColor, itemCornerRadius (unset: capsule for glass, square for flat; constant cylAnimatedItemCornerRadiusCapsule = 1000), itemBorderWidth and itemBorderColor (Flutter's style is the enum CYLAnimatedItemBackgroundStyle); every platform gains onResourceMissing(resource, reason): Android and iOS CYLAnimatedItemView.onResourceMissing, the HarmonyOS onResourceMissing prop, the mini program event resourcemissing (detail {resource, reason}), the React Native prop onResourceMissing, Flutter CYLAnimationView.onResourceMissing; global listeners CYLAnimationEngines.resourceMissingListener (Android, iOS) and CYLAnimatedItemEngines.resourceMissingListener (HarmonyOS); reason is one of "not found", "unreadable", "decode failed", "engine library missing" |
✅ iOS 的动效引擎 API 与示例页:CYLAnimatedItemView.animationRestartToken、drivesAnimationPlayback、onAnimationEnd;播放器协议 CYLTabBarItemAnimationPlayer 的可选成员 supportsSpeed / supportsLoops / supportsProgress / supportsColors、isPlaying、speed、onEnded、applyColors(_:);示例:Example-Rive 的 User Tab →「Engine API」按钮(全部播放、停在 50%、倍速、循环、onAnimationEnd)。 |
✅ Engine API of iOS and its example page: CYLAnimatedItemView.animationRestartToken, drivesAnimationPlayback, onAnimationEnd; optional members of the CYLTabBarItemAnimationPlayer protocol supportsSpeed / supportsLoops / supportsProgress / supportsColors, isPlaying, speed, onEnded, applyColors(_:); example: Example-Rive, User tab, "Engine API" button (Play all, Stop at 50%, speed, loop, onAnimationEnd). |
✅ iOS 上的 React Native 与 Flutter 视图:React Native CyltabbarAnimationView(Fabric,包装 CYLAnimatedItemView),Flutter 视图类型与 channel flutter_cyltabbar/CYLAnimationView[/<id>](CYLFlutterAnimationView),属性、事件、命令与 Android 一致,已在 iOS 模拟器上验证。,含条目背景属性(itemBackgroundStyle 等,经 CYLAnimatedItemView.itemCornerRadiusNumber 设置圆角),iOS 单元测试 RN 20 个、Flutter 17 个 |
✅ React Native and Flutter views on iOS: React Native CyltabbarAnimationView (Fabric, wraps CYLAnimatedItemView), Flutter view type and channel flutter_cyltabbar/CYLAnimationView[/<id>] (CYLFlutterAnimationView), with the same props, events and commands as Android, checked on the iOS simulator., including the item background props (itemBackgroundStyle and the rest; the radius goes through CYLAnimatedItemView.itemCornerRadiusNumber), iOS unit tests RN 20 and Flutter 17 |
✅ iOS 的动效引擎 API:CYLAnimatedItemView 与鸿蒙一致:animationPlayer(CYLTabBarItemAnimationPlayer)新增可选成员 supportsSpeed / supportsLoops / supportsProgress / supportsColors、isPlaying、speed、onEnded、applyColors(_:)(Lottie、PAG、GIF、SVGA、Rive);视图新增 drivesAnimationPlayback(默认 true;false 时视图不再应用默认播放规则,由宿主通过 animationPlayer 播放)、onAnimationEnd(只播放一次的一遍结束)、只读的 animationRestartToken(每次 restartAnimation() 加一)。URL 的 # 选项按共用测试向量解析(CYLTabBarAnimationOptionsFromURL())。只新增 API,Objective-C selector 不变。见文档。 |
✅ Engine API on iOS: CYLAnimatedItemView follows the HarmonyOS contract: animationPlayer (CYLTabBarItemAnimationPlayer) gains the optional members supportsSpeed / supportsLoops / supportsProgress / supportsColors, isPlaying, speed, onEnded and applyColors(_:) (Lottie, PAG, GIF, SVGA, Rive); the view gains drivesAnimationPlayback (default true; false means the view applies no default playback rule and the host plays through animationPlayer), onAnimationEnd (a play-once pass ended) and a read-only animationRestartToken (grows on every restartAnimation()). A URL's # options are read with the shared test vectors (CYLTabBarAnimationOptionsFromURL()). Additions only; Objective-C selectors unchanged. See the guide. |
✅ iOS 引擎 API 的验证(iPhone 18 Pro,iOS 27.2,提交 cd6305e7):Example-Rive 的 Engine API 页面上,Lottie 与 PAG 的 onAnimationEnd 会触发(截图 docs/assets/ios-engine-api-lottie-pag-end.png);关闭 drivesAnimationPlayback 后,React Native 与 Flutter 视图保持原帧直到调用 play()(docs/assets/ios-react-native-host-driven.png、docs/assets/ios-flutter-host-driven.png);原生桥接测试:Flutter RunnerTests(11 个)、React Native CyltabbarExampleTests(12 个)。Rive 在 iOS 上不报告结束(状态机没有结束事件)。 |
✅ iOS engine API, verified (iPhone 18 Pro, iOS 27.2, commit cd6305e7): onAnimationEnd fires for Lottie and PAG on the Example-Rive Engine API page (screenshot docs/assets/ios-engine-api-lottie-pag-end.png). With drivesAnimationPlayback off, the React Native and Flutter views keep their frame until play() (docs/assets/ios-react-native-host-driven.png, docs/assets/ios-flutter-host-driven.png). Native bridge tests: Flutter RunnerTests (11), React Native CyltabbarExampleTests (12). Rive reports no end on iOS (a state machine has no end event). |
✅ showsImageWhenAnimationEnds(动画结束后显示静态图):iOS、React Native、Flutter 的 CYLAnimatedItemView / CYLAnimationView 与鸿蒙、Android、微信小程序一致,默认 false;iOS 与 Android 另有只读的 isShowingImageAfterAnimationEnd。Example-Rive 的 Engine API 页面有「Show image when ended」开关;Android 端的 React Native / Flutter 转发待 Windows 会话验证。 |
|
✅ Rive 的结束回调(iOS 与 Android):Rive 状态机的一次输入(duration 大于 0)在该时长结束后触发 onAnimationEnd,showsImageWhenAnimationEnds 因此也适用于 icons.riv 这类图标(iOS CYLRiveInputPass,Android CYLRiveInputPass.kt);持续输入(duration 为 0)、触发器、数值输入和线性动画没有定时结束。Android 实测:Flutter 示例中 duration 2 的一遍播放后显示静态图片,回调计数加一(截图 docs/assets/android-flutter-rive-end-timer.png)。 |
|
✅ CYLAnimatedItemView 的背景(扁平或液态玻璃,四个平台,静态编写,iOS 仅编译检查,尚未在设备上测试):itemBackgroundStyle(flat 默认 / liquidGlass)、itemBackgroundColor、itemCornerRadius(未设置:液态玻璃为胶囊、扁平为直角;min(radius, 高度 / 2))、itemBorderWidth、itemBorderColor、只读 resolvedItemBackgroundStyle(iOS、Android)。每个示例用一个样式参数即可切换到液态玻璃(iOS item.itemBackgroundStyle = .liquidGlass,Android itemBackgroundStyle = LiquidGlass,鸿蒙 itemBackgroundStyle: liquidGlass,小程序 item-background-style="liquidGlass")。接口与引擎 API 分开,见 docs/Animated-Item.md。 React Native(props)与 Flutter(CYLAnimationView 参数)也有同样的五个名称,见 docs/Animated-Item.md「桥接名称」。 itemContentHorizontalInset(左右内边距,在边框与内容之间;未设置:已绘制的液态玻璃为 14 pt(CYLAnimatedItemLiquidGlassContentInset)、扁平为 0;resolvedItemContentHorizontalInset 返回实际值;iOS、React Native、Flutter 同名;其他平台由 Windows 会话补充)。 Animation tint and glass inset pages (Example-Rive Search tab "Tint", Example Nearby tab "Default tint"): animationTint / animationDarkTint on Rive and Lottie items, normal and selected, light and dark — docs/assets/ios-example-rive-animation-tint-light-dark.png, docs/assets/ios-example-glass-inset-normal-selected.png, docs/assets/ios-example-default-tint-light-dark.png. |
|
✅ 多个动效引擎:自动注册,并确认接入成功:每个引擎子库被引入时自动注册(与 PlusButton 相同的注册制),无需代码;+[CYLTabBarItemAnimatorRegistry registrationReport] 列出已接入的引擎(✅)、缺少的已知引擎及要加入的 pod(➖)和冲突(CYLTabBarItemAnimatorRegistry.registrationReport()。见 注册与选择动画库。 |
✅ Several animation engines: registered automatically, with a confirmation: each engine subspec registers itself when installed (the same registration model as the plus button), with no code; +[CYLTabBarItemAnimatorRegistry registrationReport] lists the engines that are in (✅), the known ones that are missing with the pod to add (➖), and the conflicts (CYLTabBarItemAnimatorRegistry.registrationReport(). See Registering and choosing a library. |
✅ 一个配置文件生成 TabBarController(#754):-initWithConfiguration:,同样的键可以写在 JSON、YAML、TOML、plist、XML、INI、Protobuf 等格式中,配置中也可以带皮肤;每个 Tab 只写一个跨端的页面 ID,由页面注册表创建页面。见 配置文件、配置文件脚本 与 按页面 ID 获得 Tab 页面。 |
✅ One configuration file creates a CYLTabBarController (#754): -initWithConfiguration:; the same keys can be written in JSON, YAML, TOML, plist, XML, INI, Protobuf and more, and a configuration can carry skins; each tab names one cross-platform page ID, and a page registry creates the page. See Configuration file, Configuration scripts and Tab pages from page IDs. |
✅ 换肤(#216,#755、#777):CYLThemeManager 一行代码切换皮肤,TabBar 在液态玻璃、系统 TabBar 与扁平样式中原地更新,颜色、图片、模糊效果与 layer 颜色可以跟随主题。见 换肤。 |
✅ Skins (#216, #755, #777): CYLThemeManager switches the skin in one line, the tab bar changes in place in Liquid Glass, the system tab bar and FlatDesign, and colors, images, blur effects and layer colors can follow the theme. See Theme switching. |
| ✅ PlusButton 在液态玻璃下的替身规则:有 PlusButton 子控制器时,选中图层中的替身只显示真实 PlusButton 普通状态的图片,并且按图标对齐,换肤前后图标完整、清晰;CI 的 “Plus child theme test” 在模拟器上检查。见 PlusButton 的实现 与 PlusButton 子控制器换肤测试。 | ✅ The PlusButton's stand-in rule on Liquid Glass: with a plus child view controller, the stand-in in the selected layer shows only the real plus button's normal image and lines up by icon, so the icon stays whole and sharp before and after a theme change; the CI workflow "Plus child theme test" checks it on a simulator. See How the PlusButton works and Plus child theme switching test. |
✅ Android 版:Kotlin 与 Java,按 iOS 公开 API 一比一翻译,并有 PAG、GIF、Rive 示例与 Maven 发布脚本;超过五个 Tab 时与 iOS 一样显示「更多」,也可用仅 Android 的 cyl_showsAllTabs 显示全部 Tab。见 Android 库、Android 示例 与 iOS 与 Android API 对照。 |
✅ An Android version: Kotlin and Java, translated one to one from the iOS public API, with PAG, GIF and Rive examples and a Maven publishing script; past five tabs it shows "More" as iOS does, or every tab with the Android-only cyl_showsAllTabs. See Android library, Android examples and the iOS–Android API map. |
✅ 滚动时缩小或隐藏 TabBar(#13):cyl_hidesTabBarOnScroll = YES 用于所有样式,只在阅读时隐藏,任何中断都会恢复。见 滚动隐藏。 |
✅ Minimize or hide the tab bar on scroll (#13): cyl_hidesTabBarOnScroll = YES in every style; it hides only while the user reads and comes back on every interruption. See Scroll hiding. |
| ✅ Tab 交互与自定义工具集(#535、#118):点击动画、声音与触感、长按、左右滑动切换 Tab、双击、重复点击返回顶部、自定义点击操作、单个 Tab 的颜色与排列方式。见 Tab 交互 与 TabBar 自定义工具集。 | ✅ Tab interactions and a customization toolkit (#535, #118): tap animations, sound and haptics, long press, swiping between tabs, double tap, reselecting to go back to the top, custom tab actions, and per-tab colors and positioning. See Tab interactions and the tab bar customization toolkit. |
| ✅ PlusButton 与 Tab 的健壮性:PlusButton 的 slot 只按一条规则插入,所有样式的 Tab 数与下标一致(#774);原地更新 Tab 的标题、图标与 PlusButton,不重建 TabBar(#601)。见 PlusButton 的 slot 与 原地更新 Tab。 | ✅ PlusButton and tab robustness: the PlusButton's slot is inserted by one rule, so tab counts and indexes match in every style (#774); tab titles, icons and the PlusButton are updated in place, without rebuilding the tab bar (#601). See PlusButton slot and Updating tabs in place. |
✅ AI 工具的 skill:cyl-new-project、cyl-plus-button 等项目专属 skill,帮助基于本库快速创建项目。见 AI 工具的 skill。 |
✅ Skills for AI tools: project skills such as cyl-new-project and cyl-plus-button help create a project with this library quickly. See Agent skills. |
| 📝 研究报告:通过配置与页面注册表注册 PlusButton 的设计方案(尚未实现),见 PlusButton 注册研究;配置中的 Tab 如何找到页面对象(已按其中选定的方案实现为页面注册表),见 Tab 页面解析研究。 | 📝 Research reports: a design for registering the PlusButton through configurations and the page registry (not implemented yet), in PlusButton registration research; how a tab in a configuration finds its page object (implemented as the page registry, with the option chosen there), in Tab page resolution research. |
CYLAnimatedItemView 的倒计时样式(「获取验证码」按钮):待机、倒计时中、结束 / The countdown style of CYLAnimatedItemView (a "Get code" button): idle, running, finished (Countdown style):
| 中文 | English |
|---|---|
| 较早版本(1.99.x)的说明与截图(iOS 27、iPhone Duo、运行时增删 PlusButton 等)见 历史版本亮点。 | Notes and screenshots of earlier versions (1.99.x: iOS 27, iPhone Duo, adding and removing the plus button at runtime) are in highlights of earlier versions. |
| APP name link icon | image | APP name link icon | image |
|---|---|---|---|
| 海底捞 App Store Link |
C家 App Store Link |
Lottie 效果 / Lottie effect ![]() |
|
| 淘必中-淘宝推出的一款具有营销购物功能的APP App Store Link |
慧诊健康 App Store Link |
||
| 究竟大学 App Store Link |
蕉片 - 短视频拍摄剪辑出电影大片 App Store Link |
![]() |
|
| 闪剧 - 可以玩的短视频 App Store Link |
土狗云商城 App Store Link |
![]() |
|
| Analyst.ai App Store Link |
美膳校园 App Store Link |
||
| 全聚星 App Store Link |
Yesoul App Store Link |
||
| 贵州充电通 App Store Link |
卓尔购 App Store Link |
||
| 卓越管家 App Store Link |
悦守护 App Store Link | ![]() |
|
| 筑集采采购端 App Store Link |
![]() |
筑集采供应端 App Store Link |
![]() |
| 桂富宝 App Store Link |
小猪奔奔 App Store Link |
||
娃娃坞(开发中 / in development)![]() |
![]() |
更多 APP 请访问 / More apps: 《使用 CYLTabBarController 做的 APP,来这里报道下吧》 / Apps built with CYLTabBarController | 如果你正在使用,也请提交到这里 / Using it? Add your app here: #314 |
| 中文 | English |
|---|---|
| 一行代码支持 Lottie 动画 TabBar 使用方法 |
One line of code enables an animated TabBar with Lottie. Usage |
| 低耦合,易删除 TabBar 配置与业务代码完全分离;PlusButton 由独立子类管理。 |
Loosely coupled and easy to remove. TabBar configuration is independent from business code, and PlusButton is managed by a separate subclass. |
使用系统原生控件TabBar 和 TabBarItem 保持系统行为,并支持外观 API。 |
Uses native system controls.TabBar and TabBarItem preserve system behavior and support the appearance APIs. |
| 自动管理 PlusButton 自动检测 PlusButton、计算位置并完成布局;按钮样式和 frame 由自定义类实现。 |
Automatically manages PlusButton. The library detects the PlusButton, calculates its position, and lays it out automatically. |
| 支持动态更新 可以动态添加或删除 PlusButton,并更新 TabBar 样式。 |
Supports runtime updates. Add or remove the PlusButton and update the TabBar appearance at runtime. |
| 支持超出 TabBar 区域点击 PlusButton 超出 TabBar 的部分仍可响应点击。 |
Supports taps outside the TabBar bounds. The portion of PlusButton extending beyond the TabBar can still receive taps. |
| 支持指定 PlusButton 位置 可指定 PlusButton 的位置,并支持 Airbnb 风格布局。 |
Supports a custom PlusButton position. Place the PlusButton at a custom index and support Airbnb-style layouts. |
| 仅显示图标并垂直居中 不设置标题即可只显示图标,并可自定义 TabBar 高度。 |
Icon-only, vertically centered items. Omit the title to show only icons and customize the TabBar height. |
| 支持自定义角标 View 可以使用自定义 View 展示角标。 |
Supports custom badge views. Use a custom view to display badges. |
动效 item 自己的角标,图标居中CYLAnimatedItemView.badgeValue / badgeAttributes / reservesBadgeSpace:角标由 item 自己绘制,图标居中、尺寸不变,不需要把图标和角标合成一张图片;没有图标时角标锚定在标题上,早于图标设置的角标之后仍会显示(说明,iOS 验收截图)。 |
The animated item's own badge, the icon stays centred.CYLAnimatedItemView.badgeValue / badgeAttributes / reservesBadgeSpace: the item draws the badge itself, so the icon is centred and keeps its size, and no image of icon plus badge is rendered; with no icon the badge anchors on the title, and a badge set before the icon still shows (details). |
| 支持多 TabBar 嵌套 可嵌套多个 TabBar,并指定 PlusButton 所属的 context。 |
Supports nested TabBars. Nest multiple TabBars and associate a PlusButton with a specific context. |
| CocoaPods、Carthage、Swift Package Manager 核心库用 Swift 编写,保留全部 Objective-C 接口;另有 Android、React Native、Flutter、鸿蒙与微信小程序版本。 |
CocoaPods, Carthage and Swift Package Manager. The core is written in Swift and keeps its whole Objective-C API; there are Android, React Native, Flutter, HarmonyOS and WeChat mini program versions too. |
| 支持横竖屏 自动适配不同屏幕方向。 |
Supports portrait and landscape orientations. Layout adapts to both orientations. |
| 中文 | English |
|---|---|
| 本仓库配套 Demo 的效果 | Demo included in this repository![]() |
| 另一个 Demo:CYLTabBarControllerDemoForWeib | Another demo: CYLTabBarControllerDemoForWeib![]() |
├── CYLTabBarController # 核心库(Swift,保留 Objective-C 接口)与可选子库 / The library (Swift, keeping its Objective-C API) and its optional subspecs
├── Example*/ # iOS 演示工程,见下表 / iOS demo projects, see the table below
├── Example-Android/ # Android 库(Kotlin)与示例 / The Android library (Kotlin) and its examples
├── CrossPlatform/ # React Native、Flutter、鸿蒙、微信小程序组件与示例 / React Native, Flutter, HarmonyOS and WeChat mini program components and examples
└── docs/ # 每个功能一份双语文档 / One bilingual document per feature
| 中文 | English |
|---|---|
先打开 Example-Swift-03(Swift Package Manager)。仍需 CocoaPods 的示例列在 CocoaPods 文档。 |
Start with Example-Swift-03 (Swift Package Manager). Demos that still need CocoaPods are listed in the CocoaPods document. |
| 工程 / Project | 演示内容 / What it shows | 集成方式 / Integration | iOS |
|---|---|---|---|
Example-Swift-03 |
Swift 健康类 App(HealthyHome),其源码也被 SwiftUI、Carthage、PAG、SPM 示例共用 / A Swift health app (HealthyHome) whose sources the SwiftUI, Carthage, PAG and SPM demos share | SPM | 15.0 |
Example-Swift |
Lottie 4.x 动画 Tab 图标 / Lottie 4.x animated tab icons | SPM + Lottie |
15.0 |
Example-SwiftUI |
在 SwiftUI App 中使用 CYLTabBarController / CYLTabBarController in a SwiftUI app | SPM | 15.0 |
Example-GIF |
GIF 动画 Tab 图标,与循环播放的图片对比 / GIF animated tab icons, next to a looping image | SPM | 15.0 |
Example-network-download |
扁平样式,Tab 图标从网络下载 / FlatDesign, tab icons downloaded from the network | SPM | 15.0 |
Example-Swift-SwiftManager |
用 Swift Package Manager 集成(HealthyHome) / Integration with Swift Package Manager (HealthyHome) | SPM | 26.0 |
Example-Swift-SwiftManager-FlatDesign |
SPM 集成的扁平样式 / FlatDesign through SPM | SPM | 15.0 |
Example-Swift-Gallery |
纯 Swift 的 TabBar 场景合集 / A pure Swift gallery of tab bar scenes | SPM | 15.0 |
Example-Swift-Carthage |
用 Carthage 集成预编译的 XCFramework / Integration of the prebuilt XCFramework with Carthage | Carthage | 15.0 |
Example-Shared |
各 Swift 示例共用的源码与配置文件,不是独立工程 / Sources and configuration files shared by the Swift demos, not a project | - | - |
Example-Android |
Android 库(Kotlin)与示例:主示例、GIF、PAG、Rive(文档)/ The Android library (Kotlin) and its examples: main, GIF, PAG, Rive (doc) | Gradle | Android |
CrossPlatform/react-native-cyltabbar/example、example-pag、example-rive |
React Native 组件示例;后两个是 Example-PAG、Example-Rive 的 React Native 版本(文档)/ The React Native component's examples; the last two are React Native versions of Example-PAG and Example-Rive (doc) |
npm | 15.1 |
CrossPlatform/flutter_cyltabbar/example、example_pag、example_rive |
Flutter 组件示例;后两个是 Example-PAG、Example-Rive 的 Flutter 版本(文档)/ The Flutter component's examples; the last two are Flutter versions of Example-PAG and Example-Rive (doc) |
pub | 15.0 |
CrossPlatform/harmonyos-cyltabbar/entry |
鸿蒙组件示例,一比一复刻 Objective-C 示例(文档)/ The HarmonyOS component's example, a one-to-one replica of the Objective-C example (doc) | ohpm | HarmonyOS 6.0.1 |
CrossPlatform/wechat-miniprogram-cyltabbar/example |
微信小程序组件示例(文档)/ The WeChat mini program component's example (doc) | npm |
| 中文 | English |
|---|---|
| podspec 最低 iOS 15.0(2026-11-20 起,原为 12.0;所有子库均为 15.0);SPM 需要 iOS 15。Xcode 27 只能构建 iOS 15.0 及以上,因此新工程使用 15.0。 | The podspec's minimum is iOS 15.0 (since 2026-11-20, was 12.0; every subspec is 15.0); SPM needs iOS 15. Xcode 27 only builds for iOS 15.0 and later, so new projects use 15.0. |
iOS 26 及以上默认显示液态玻璃;CYLTabBarStyleTypeFlatDesign 在所有系统上保持经典布局。使用 iOS 27 SDK 构建必须采用 UIScene 生命周期。 |
iOS 26 and later show Liquid Glass by default; CYLTabBarStyleTypeFlatDesign keeps the classic layout on every system. Building with the iOS 27 SDK requires the UIScene life cycle. |
用 AI 工具创建新项目时,可直接使用 .agents/skills 中的 cyl-new-project 等 skill,见 docs/Agent-Skills.md。 |
When creating a new project with an AI tool, use the skills in .agents/skills, starting with cyl-new-project. See docs/Agent-Skills.md. |
| 中文 | English |
|---|---|
四步搭建主流 App 结构。代码取自 Swift 示例(Example-Swift-04、Example-Rive)。全部参数、PlusButton 协议与更多自定义见 使用指南(同样为 Swift)。 |
Four steps build a mainstream app structure. The code comes from the Swift demos (Example-Swift-04, Example-Rive). For every parameter, the plus button protocol and more customization, see the usage guide (Swift too). |
| 中文 | English |
|---|---|
用 Swift Package Manager 按版本依赖。需要 PAG 或 SVGA 时见 CocoaPods 安装。从本版本起不再支持 Lottie 2.x(Objective-C 版 lottie-ios),请升级到 Lottie-Swift(lottie-ios 4.x,iOS 15):SPM 使用 Lottie trait,CocoaPods 使用 CYLTabBarController/LottieSwift(旧名 CYLTabBarController/Lottie 现在等同于它,LottieObjectiveC 已移除)。 |
Depend on a version through Swift Package Manager. For PAG or SVGA see installing with CocoaPods. From this version on, Lottie 2.x (the Objective-C lottie-ios) is no longer supported; upgrade to Lottie-Swift (lottie-ios 4.x, iOS 15): use the Lottie trait with SPM, or CYLTabBarController/LottieSwift with CocoaPods (the old name CYLTabBarController/Lottie now means the same, and LottieObjectiveC is removed). |
| 中文 | English |
|---|---|
Objective-C 使用 SwiftPM:@import CYLTabBarController;;#import <CYLTabBarController/CYLTabBarController.h> 从 1.100.2 之后的版本起也可用(需开启 Clang modules)。 |
Objective-C with SwiftPM: @import CYLTabBarController;; #import <CYLTabBarController/CYLTabBarController.h> also works from the release after 1.100.2 (Clang modules enabled). |
Swift Package Manager(Xcode:File ▸ Add Package Dependencies…,或写进 Package.swift)/ Swift Package Manager (Xcode: File ▸ Add Package Dependencies…, or in Package.swift):
dependencies: [
.package(url: "https://github.com/ChenYilong/CYLTabBarController-Swift.git", from: "1.100.6"),
// The thin source mirror (a few MB, not the whole repository).
// No animation library: add `traits: []` to the package line. lottie-spm and rive-ios stay out of the download only with Swift 6.3+ / Xcode 27; older toolchains still fetch them (docs/Swift-Package-On-Demand-Engines.md, "Consumer troubleshooting").
// Rive: `traits: [.trait(name: "Rive")]`; Lottie and Rive together: `traits: [.trait(name: "Lottie"), .trait(name: "Rive")]` (naming a trait replaces the default one).
// Use ONE of the two URLs in the whole app: both together fail to resolve (same target names). If you also use CYLTableViewPlaceHolder or CYLSearchViewController through SwiftPM, use the URL they use.
],
targets: [
.target(name: "YourApp", dependencies: [
.product(name: "CYLTabBarController", package: "CYLTabBarController-Swift"), // the tab bar, with badges and Lottie
// Or only a component, without the tab bar:
// .product(name: "CYLAnimatedItem", package: "CYLTabBarController-Swift"), // import CYLAnimatedItemViews
// .product(name: "CYLBadge", package: "CYLTabBarController-Swift"), // import CYLBadge
// .product(name: "CYLUtilsKit", package: "CYLTabBarController-Swift"), // import CYLUtilsKit
]),
]| 中文 | English |
|---|---|
四个产品依赖关系:CYLTabBarController 包含其余三个;CYLAnimatedItem 依赖 CYLBadge;CYLBadge 依赖 CYLUtilsKit。只依赖子组件产品时,TabBar 与 Lottie 不会被编译或链接(SwiftPM 解析时仍会下载 lottie-spm),同一个包里的每个子组件只有一份,不会重复。注意:SPM 的 CYLTabBarController 产品没有 CocoaPods 的“只有 Core”变体,总是带扁平样式与 Lottie。需要 iOS 15。三个子组件产品只在本分支的 Package.swift 里,合并到 master 前 master 只有 CYLTabBarController 一个产品。from: 版本号写法要等两件事:生命周期库 CYLDeallocBlockExecutor 打 1.4.0 标签,以及本库发布一个包含这份 Package.swift 的新版本(见 使用指南);在此之前请用 branch: 或 revision:。不要在同一个 App 里把本库既用 SPM 又用 CocoaPods 引入:两边各有一份同名类。按需依赖某个动效引擎的方案见 Swift package: on-demand engines(英文,尚未实现)。 |
The four products: CYLTabBarController includes the other three; CYLAnimatedItem depends on CYLBadge; CYLBadge depends on CYLUtilsKit. A component product alone neither builds nor links the tab bar or Lottie (SwiftPM still downloads lottie-spm when it resolves), and each component is in the package once, so nothing is duplicated. Note: the SPM CYLTabBarController product has no Core-only variant like CocoaPods; it always brings FlatDesign and Lottie. iOS 15 is required. The three component products exist only in this branch's Package.swift: until it is merged, master has the single CYLTabBarController product. The from: version form needs two things: the lifecycle library CYLDeallocBlockExecutor tagged 1.4.0, and a new release of this library that contains this Package.swift (see docs/Animated-Item-Badge.md); until then use branch: or revision:. Do not bring this library into one app through both SPM and CocoaPods: each has its own copy of the same classes. A plan to depend on one animation engine only is in Swift package: on-demand engines (English, not implemented yet). |
import UIKit
import CYLTabBarController
final class MainTabBarController: CYLTabBarController {
convenience init() {
self.init(viewControllers: [
UINavigationController(rootViewController: HomeViewController()),
UINavigationController(rootViewController: MessageViewController()),
], tabBarItemsAttributes: [
[cylTabBarItemTitle: "Home",
cylTabBarItemImage: "home_normal", // an image name (recommended) or a UIImage
cylTabBarItemSelectedImage: "home_highlight",
cylTabBarItemDarkImage: "home_normal_night"], // optional: Dark Mode
[cylTabBarItemTitle: "Messages",
cylTabBarItemImage: "message_normal",
cylTabBarItemSelectedImage: "message_highlight"],
])
}
}| 中文 | English |
|---|---|
或者用一个配置文件(JSON、YAML、plist 等)描述 Tab、PlusButton 与皮肤:try CYLTabBarController(configurationFile: path),见 配置文件。 |
Or describe the tabs, the plus button and skins in one configuration file (JSON, YAML, plist and more): try CYLTabBarController(configurationFile: path); see Configuration file. |
不写 CYLTabBarItemTitle 时只显示图标并垂直居中。 |
Leave out CYLTabBarItemTitle to show only the icon, centered vertically. |
// SceneDelegate (an app built with the iOS 27 SDK must use the UIScene life cycle)
func scene(_ scene: UIScene, willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }
let window = UIWindow(windowScene: windowScene)
window.cylSetRootViewControllerProvider { MainTabBarController() }
window.makeKeyAndVisible()
self.window = window
}final class PlusButton: CYLPlusButton, CYLPlusButtonSubclassing {
static func plusButton() -> Any {
PlusButton.cyl_plusButton(with: UIImage(named: "post_normal")!, title: "Post",
selectedTitle: nil, selectedTitleColor: nil)
}
static func indexOfPlusButtonInTabBar() -> UInt { 2 }
// Raised above the bar's top edge.
static func constantOfPlusButtonCenterYOffset(forTabBarHeight _: CGFloat) -> CGFloat { -14 }
// Optional: a page of its own, selected like a tab.
static func plusChildViewController() -> UIViewController {
UINavigationController(rootViewController: PublishViewController())
}
}
// Register it before the first CYLTabBarController is created (AppDelegate, or the SwiftUI App's init).
PlusButton.register()| 中文 | English |
|---|---|
不要在 +load 中注册。PlusButton 的全部协议方法、图片规则与限制见 使用指南:PlusButton 与 PlusButton。 |
Do not register it in +load. For every protocol method, the image rules and the limits, see the usage guide: plus button and PlusButton. |
| 功能 / Feature | 文档 / Document |
|---|---|
| 自定义 TabBar 外观、液态玻璃与扁平样式 / Tab bar appearance, Liquid Glass and FlatDesign | 使用指南、扁平样式外观 |
| 点击动画、声音、触感与手势 / Tap animations, sounds, haptics and gestures | 使用指南、Tab 交互 |
| Lottie、PAG、Rive、SVGA、GIF 动画图标 / Lottie, PAG, Rive, SVGA and GIF animated icons | 动画图标快速上手 |
| 角标(CYLBadgeView)/ Badges (CYLBadgeView) | 使用指南;最小尺寸、内边距、文字属性、VoiceOver 描述 / minimum size, insets, text attributes, VoiceOver wording:角标选项 / badge options;其他平台 / other platforms:跨平台 / cross-platform |
| 深色模式、本地化、横竖屏 / Dark Mode, localization, orientation | 使用指南 |
| 换肤 / Skins | 换肤 |
| 滚动时缩小或隐藏 TabBar / Minimize or hide the bar on scroll | 滚动隐藏 |
| 全部文档 / Every document | 见上方「文档索引」/ see the documentation index above |
| 平台 / Platform | 位置 / Where | 文档 / Document |
|---|---|---|
| Android(Kotlin,Java 可用 / usable from Java) | Example-Android/cyltabbar |
Android 库 |
| React Native | CrossPlatform/react-native-cyltabbar |
跨端组件 |
| Flutter | CrossPlatform/flutter_cyltabbar |
跨端组件 |
| 鸿蒙 / HarmonyOS(ArkTS / ArkUI) | CrossPlatform/harmonyos-cyltabbar |
鸿蒙对照 |
| 微信小程序 / WeChat mini program | CrossPlatform/wechat-miniprogram-cyltabbar |
微信小程序 |
Flutter 与 React Native 基础示例在 iOS 上链接 Rive 后的 TabBar / The Flutter and React Native basic examples on iOS with Rive linked (Rive):
| 中文 | English |
|---|---|
| 常见问题已移到 docs/FAQ.md,包括原 README 中的问答(第 11 节)。 | The FAQ lives in docs/FAQ.md, including the questions that used to be in this README (section 11). |
| 中文 | English |
|---|---|
| (更多 iOS 开发干货,欢迎关注 微博@iOS程序犭袁) | (For more iOS development tips, follow @iOS程序犭袁 on Weibo.) |
| 中文 | English |
|---|---|
| 发布者:微博@iOS程序犭袁 & 公众号@iTeaTime技术清谈 | Posted by @iOS程序犭袁 on Weibo & @iTeaTime技术清谈 on WeChat |
| 中文 | English |
|---|---|
| 原创作品,版权声明:License MIT | Original work. Copyright license: MIT. |


























