LiveTabBar
示例
要运行示例项目,首先克隆仓库,然后从示例目录运行`pod install`。或者,您可以从终端运行`pod try LiveTabBar`。
关于
LiveTabBar 是一个为iOS标签页应用添加美观的简单方法。它提供了一个简单的界面来对标签栏项目进行动画处理和项目徽章。该库使用 Core Animation(CAAnimation
)并提供了一套默认动画,但只要它们符合 CAAnimation
,您也可以创建自己的动画。
使用方法
标签控制器
使用 LiveTabBarController
替代 UITabBarController
,提供标签动画。它继承自 UITabBarController
,界面没有被限制或修改。从那里,正常添加您的标签和控制台。
let tabController = LiveTabBarController(tabItemAnimation: animationOption)
tabController.viewControllers = [...
self.window?.rootViewController = UINavigationController(rootViewController: tabController)
徽章
为了简化界面,实时徽章被实现为 UITabBarController
的扩展,可以在不进行多余转换的情况下显示和隐藏。例如
self.tabBarController?.setLiveBadge(tabPageIndex: 0, value: "1", backgroundColor: .red, animation: DefaultAnimation.wobble) // present
self.tabBarController?.dismissLiveBadge(tabPageIndex: self.tabPageIndex, fadeDuration: 0.25) // dismiss
安装
LiveTabBar 通过 CocoaPods 提供。安装它时,只需将以下行添加到您的 Podfile
pod 'LiveTabBar'
许可协议
LiveTabBar 在 MIT 许可协议下可用。有关更多信息,请参阅 LICENSE 文件。