ZPSegmentBarOC 0.2.5

ZPSegmentBarOC 0.2.5

测试已测试
语言语言 Objective-CObjective C
许可证 MIT
发布最后发布2019年6月

zswangzP105318 维护。



ZPSegmentBarOC 该框架分为OC和Swift两个版本:点击前往Swift版本

模仿今日头条或者是网易新闻 NavigationBar 效果,效果图如下

scroll.gif
scroll2.gif

集成该框架步骤

1. 导入ZPSegmentView头文件: #import "ZPSegmentView.h"
2. 实例化ZPSegmentBarStyle,并且传入我们需要的样式,例如
ZPSegmentBarStyle * style=[[ZPSegmentBarStyle alloc] init];
style.isScrollEnabled=YES;//导航条是否可以滚动,默认YES;
style.isShowCover=YES;//导航条是否显示遮盖效果,默认YES;
style.coverViewMargin=6;//遮盖间距;
style.isShowBottomLine=YES;//导航条下方是否显示BottomLine,默认YES;
style.bottomLineColor=[UIColor orangeColor];//BottomLine 的颜色;
style.isNeedScale=YES;//导航条是否有放大效果,默认YES;
style.titleViewBG=[UIColor purpleColor];//导航条背景颜色,默认为紫色;
...
...
...  

通过配置我们需要的样式可以轻松的实现遮盖 文字缩放 下划线 文字颜色变化 等样式.

3. 实例化 ZPSegmentView 并传入所需的参数
ZPSegmentView * segmentView=[[ZPSegmentView alloc]initWithFrame:frame];
[segmentView setupWithtitles:titles style:style childVcs:childVcs parentVc:self];
    
4. 将创建好的 ZPSegmentView 添加到当前 View 中即可

[self.view addSubview:segmentView];

注意

如果是导航控制器,我们需要在集成的 View 中设置 [self setAutomaticallyAdjustsScrollViewInsets:NO];

安装

ZPSegmentBarOC 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'ZPSegmentBarOC', '~> 0.2.0'

作者

作者简书

[email protected][email protected]

许可

ZPSegmentBarOC 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。