BFPaperTabBar 1.0.6

BFPaperTabBar 1.0.6

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2015年4月

Bence Feher维护。



  • Bence Feher

我不再支持这个库。

请考虑使用BFPaperTabBarController代替,我支持它,而且它比BFPaperTabBar更有效!

iOS UITabBar受到谷歌Paper Material Design的启发。

Animated Screenshot
(左下角的小点只是iOS模拟器的圆角显示。注意,有时iOS模拟器可能在BFPaperTabBar上显示一些奇怪的线条颜色。这在实际设备上是看不到的。

待办事项

劝说您使用BFPaperTabBarController而不是这个库!!!
重新排列标签页。
添加/删除标签页。
在尝试实现上述功能时停止哭泣。

关于

BFPaperTabBar是UITabBar的一个子类,其行为类似于谷歌Material Design Labs中的新paper标签栏。所有动画都是异步执行的,并在子层执行。BFPaperTabBar立即使用令人愉悦的默认行为工作,但是它们可以轻松地进行自定义!点按圆圈的颜色、背景渐变颜色、点按圆圈直径、下划线颜色和下划线粗细都可以通过公共属性轻松自定义。

默认情况下,BFPaperTabBar使用“智能颜色”,这将匹配点按圆圈、背景渐变和下划线条的颜色,与tabBar.tintColor的颜色相匹配。您可以通过将属性.usesSmartColor设置为NO来关闭智能颜色。如果您禁用智能颜色,点按圆圈和背景颜色渐变都会默认使用灰色。您可以通过以下方式设置自己的颜色:.tapCircleColor.backgroundFadeColor。注意,设置这些将禁用智能颜色。

属性

BOOL usesSmartColor
一个标志,用于设置YES以使用智能颜色,或NO以使用自定义颜色方案。在默认情况下(usesSmartColor = YES),自定义也很酷。

UIColor *tapCircleColor
用于在您点按的位置出现圆圈的UIColor。注释:设置此选项将取消点按圆圈的“智能颜色”功能。建议使用小于1的alpha值。

UIColor *backgroundFadeColor
用于淡出透明背景的UIColor。注释:设置此选项将取消背景渐变的“智能颜色”功能。建议使用值为1的alpha值,因为渐变(clearBGFadeConstant)是在BFPaperTabBar.m中定义的常数。这让我也感到烦恼。

CGFloat tapCircleDiameter
表示点按圆圈直径的CGFloat值。默认情况下,它将计算为足够大,可以覆盖整个背景。任何小于零的值都将使用默认值。还有三个令人愉悦的大小,bfPaperTabBar_tapCircleDiameterSmallbfPaperTabBar_tapCircleDiameterMediumbfPaperTabBar_tapCircleDiameterLarge也可以使用。

BOOL rippleFromTapLocation
设置此标志为YES,则触摸点产生的按圈涟漪。如果设置为NO,按圈波浪总是从标签中心产生。默认为YES。

UIColor *underlineColor
用于当前选中标签下方下划线的UIColor。注意:设置此值将取消此下划线的“智能颜色”功能。

CGFloat underlineThickness
用于设置下划线厚度(高度)的CGFloat。注意:任何大于1的值将覆盖默认TabBarItem标题中悬挂字母的底部。

BOOL showUnderline
设置此标志为YES以显示跟踪当前选中标签的下划线栏。

BOOL showTapCircleAndBackgroundFade
设置此标志为YES以显示按圈和背景渐变。如果设置为NO,则它们将不会显示。

用法

BFPaperTabBar头文件和实现文件添加到您的项目中。(.h和.m)

使用Storyboard

使用BFPaperTabBar的最简单方法是设置一个UITabBarController到您的Storyboard,然后将其UITabBar的类设置为BFPaperTabBar。Set Class

通过代码创建BFPaperTabBar

BFPaperTabBar *tabBar = [[BFPaperTabBar alloc] init];

自定义示例

将UITabBarController的UITabBar类设置为BFPaperTabBar后:(直接从示例项目中提取。)

((BFPaperTabBar *)self.tabBar).rippleFromTapLocation = NO;  // YES = spawn tap-circles from tap locaiton. NO = spawn tap-circles from the center of the tab.

((BFPaperTabBar *)self.tabBar).usesSmartColor = NO; // YES = colors are chosen from the tabBar.tintColor. NO = colors will be shades of gray.

((BFPaperTabBar *)self.tabBar).tapCircleColor = [[UIColor paperColorLightBlue] colorWithAlphaComponent:0.2];    // Set this to customize the tap-circle color.

((BFPaperTabBar *)self.tabBar).backgroundFadeColor = [UIColor paperColorGreen800];  // Set this to customize the background fade color.

((BFPaperTabBar *)self.tabBar).tapCircleDiameter = bfPaperTabBar_tapCircleDiameterLarge;    // Set this to customize the tap-circle diameter.

((BFPaperTabBar *)self.tabBar).underlineColor = [UIColor paperColorDeepPurpleA400]; // Set this to customize the color of the underline which highlights the currently selected tab.

((BFPaperTabBar *)self.tabBar).showUnderline = NO;  // YES = show the underline bar, NO = hide the underline bar.

((BFPaperTabBar *)self.tabBar).underlineThickness = 2.f;    // Set this to adjust the thickness (height) of the underline bar. Not that any value greater than 1 could cover up parts of the TabBarItem's title.

((BFPaperTabBar *)self.tabBar).showTapCircleAndBackgroundFade = NO; // YES = show the tap-circles and add a color fade the background. NO = do not show the tap-circles and background fade.

许可协议

BFPaperTabBar使用MIT许可协议

请参阅包含的LICENSE文件