升级到1.6.1
A powerful and easy to use category view (segmentedcontrol, segmentview, pagingview, pagerview, pagecontrol) (腾讯新闻、今日头条、QQ 音乐、网易云音乐、京东、爱奇艺、腾讯视频、淘宝、天猫、简书、微博等所有主流 APP 分类切换滚动视图)
与其他的同类三方库对比的优点:
如果你在找 Swift 版本,请点击查看 JXSegmentedView。
以下均支持上下位置切换: JXCategoryIndicatorLineView、JXCategoryIndicatorImageView、JXCategoryIndicatorBallView、JXCategoryIndicatorTriangleView
JXCategoryIndicatorLineView
JXCategoryIndicatorImageView
JXCategoryIndicatorBallView
JXCategoryIndicatorTriangleView
SegmentedControlViewController
NaviSegmentedControlViewController
NestViewController
PagingViewController
VerticalListViewController
VerticalListTableViewController
ScrollZoomViewController
LoadDataListContainerViewController
收录来自其他使用者的自定义示例,这些自定义类只在 Demo 项目里面,Pod 库并没有这些文件。所以,如果你需要使用这些自定义效果,请通过文件导入的方式。
目的:
欢迎提 PullRequest 进行收录你的自定义效果。
Clone 代码,把 Sources 文件夹拖入项目,#import "JXCategoryView.h" 就可以使用了。
#import "JXCategoryView.h"
target '<Your Target Name>' do pod 'JXCategoryView' end
先执行 pod repo update,再执行 pod install。
pod repo update
pod install
初始化 JXCategoryTitleView:
JXCategoryTitleView
self.categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, WindowsSize.width, 50)]; self.categoryView.delegate = self; [self.view addSubview:self.categoryView];
配置 JXCategoryTitleView 的属性:
self.categoryView.titles = @[@"螃蟹", @"麻辣小龙虾", @"苹果"...]; self.categoryView.titleColorGradientEnabled = YES;
添加指示器:
JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; lineView.indicatorColor = [UIColor redColor]; lineView.indicatorWidth = JXCategoryViewAutomaticDimension; self.categoryView.indicators = @[lineView];
实现 JXCategoryViewDelegate 代理(可选) ```Objective-C // 点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,不关心具体是点击还是滚动选中的。
JXCategoryViewDelegate
// 点击选中的情况才会调用该方法
// 滚动选中的情况才会调用该方法
// 正在滚动中的回调
JXCategoryListContainerView
JXCategoryListContainerView 是对列表视图高度封装的类,具有以下优点:
UIScrollView
willAppear
didAppear
willDisappear
didDisappear
初始化 JXCategoryListContainerView 并关联到 categoryView:
categoryView
self.listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; [self.view addSubview:self.listContainerView]; // 关联到 categoryView self.categoryView.listContainer = self.listContainerView;
实现 JXCategoryListContainerViewDelegate 代理方法: ```Objective-C // 返回列表的数量
JXCategoryListContainerViewDelegate
JXCategoryListContentViewDelegate
UIView
UIViewController
具体点击 LoadDataListContainerViewController 查看源代码了解
因为代码量较多且分散,所有不推荐使用该方法。要正确使用需要注意的地方比较多,尤其对于刚接触 iOS 的同学来说不太友好。
不直接贴代码了,具体点击 LoadDataListCustomViewController 查看源代码了解。
❗️❗️❗️这里面包含了许多常见问题和答案,使用之前请务必浏览此文档,或者遇到问题先看此文档❗️❗️❗️
常见问题和答案总文档
JXCategoryListContainerType
scrollView
collectionView
FDFullscreenPopGesture
reloadDataWithoutListContainer
presentViewController
JXCategoryIndicatorProtocol
JXCategoryIndicatorComponentView
JXCategoryIndicatorView
JXCategoryIndicatorCell、
,就像
、
JXCategoryTitleCellModel
JXCategoryTitleImageView
JXCategoryTitleAttributeView
常用属性说明文档地址
- (BOOL)selectCellAtIndex:(NSInteger)index selectedType:(JXCategoryCellSelectedType)selectedType
JXCategoryListCollectionContainerView.dataSource
- (instancetype)initWithDataSource:(id<JXCategoryListCollectionContainerViewDataSource>)dataSource
- (void)categoryView:(JXCategoryBaseView *)categoryView didClickedItemContentScrollViewTransitionToIndex:(NSInteger)index;
contentScrollViewClickTransitionAnimationEnabled
JXCategoryTitleVerticalZoomView
contentEdgeLeft
JXCategoryListCollectionContainerView
- (void)scrollingFromLeftIndex:(NSInteger)leftIndex toRightIndex:(NSInteger)rightIndex ratio:(CGFloat)ratio selectedIndex:(NSInteger)selectedIndex
- (void)didClickSelectedItemAtIndex:(NSInteger)index
如果刚开始使用JXCategoryView,当开发过程中需要支持某种特性时,请务必先搜索使用文档或者源代码。确认是否已经实现支持了想要的特性。请别不要文档和源代码都没有看,就直接提问,这对于大家都是一种时间浪费。如果没有支持想要的特性,欢迎提Issue讨论,或者自己实现提一个PullRequest。
JXCategoryView
该仓库保持随时更新,对于主流新的分类选择效果会第一时间支持。使用过程中,有任何建议或问题,可以通过以下方式联系我: 邮箱:317437084@qq.com QQ群: 112440473
喜欢就star❤️一下吧
JXCategoryView is released under the MIT license.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
A powerful and easy to use category view (segmentedcontrol, segmentview, pagingview, pagerview, pagecontrol) (腾讯新闻、今日头条、QQ 音乐、网易云音乐、京东、爱奇艺、腾讯视频、淘宝、天猫、简书、微博等所有主流 APP 分类切换滚动视图)
与其他的同类三方库对比的优点:
Swift版本
如果你在找 Swift 版本,请点击查看 JXSegmentedView。
效果预览
指示器效果预览
以下均支持上下位置切换:
JXCategoryIndicatorLineView
、JXCategoryIndicatorImageView
、JXCategoryIndicatorBallView
、JXCategoryIndicatorTriangleView
Cell样式效果预览
特殊效果预览
averageCellSpacingEnabled默认为YES
averageCellSpacingEnabled为NO
参考
SegmentedControlViewController
类参考
NaviSegmentedControlViewController
类参考
NestViewController
类参考
PagingViewController
类更多样式请点击查看JXPagingView库
参考
VerticalListViewController
类高仿腾讯视频
支持UITableView,参考
VerticalListTableViewController
(背景色异常是录屏软件bug)
参考
ScrollZoomViewController
类参考
LoadDataListContainerViewController
类自定义效果预览
收录来自其他使用者的自定义示例,这些自定义类只在 Demo 项目里面,Pod 库并没有这些文件。所以,如果你需要使用这些自定义效果,请通过文件导入的方式。
目的:
欢迎提 PullRequest 进行收录你的自定义效果。
要求
安装
手动
Clone 代码,把 Sources 文件夹拖入项目,
#import "JXCategoryView.h"
就可以使用了。CocoaPods
先执行
pod repo update
,再执行pod install
。结构图
使用
JXCategoryTitleView 使用示例
初始化
JXCategoryTitleView
:配置
JXCategoryTitleView
的属性:添加指示器:
实现
JXCategoryViewDelegate
代理(可选) ```Objective-C // 点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,不关心具体是点击还是滚动选中的。// 点击选中的情况才会调用该方法
// 滚动选中的情况才会调用该方法
// 正在滚动中的回调
列表容器使用示例
JXCategoryListContainerView
封装类使用示例JXCategoryListContainerView
是对列表视图高度封装的类,具有以下优点:UIScrollView
自定义,封装度高、代码集中、使用简单;willAppear
、didAppear
、willDisappear
、didDisappear
生命周期方法调用;初始化
JXCategoryListContainerView
并关联到categoryView
:实现
JXCategoryListContainerViewDelegate
代理方法: ```Objective-C // 返回列表的数量JXCategoryListContentViewDelegate
协议的列表实例JXCategoryListContentViewDelegate
代理方法 不管列表是UIView
还是UIViewController
都可以,提高使用灵活性,更便于现有的业务接入。 ```Objective-C // 返回列表视图 // 如果列表是 VC,就返回 VC.view // 如果列表是 View,就返回 View 自己具体点击 LoadDataListContainerViewController 查看源代码了解
直接使用 UIScrollView 自定义
因为代码量较多且分散,所有不推荐使用该方法。要正确使用需要注意的地方比较多,尤其对于刚接触 iOS 的同学来说不太友好。
不直接贴代码了,具体点击 LoadDataListCustomViewController 查看源代码了解。
常见问题和答案
❗️❗️❗️这里面包含了许多常见问题和答案,使用之前请务必浏览此文档,或者遇到问题先看此文档❗️❗️❗️
常见问题和答案总文档
JXCategoryListContainerType
的scrollView
和collectionView
对比FDFullscreenPopGesture
等全屏手势处理reloadDataWithoutListContainer
方法使用说明presentViewController
方法JXCategoryListContainerView
内部使用UIViewController
当做列表容器使用说明指示器样式自定义
JXCategoryIndicatorProtocol
协议,点击参看 JXCategoryIndicatorProtocol;JXCategoryIndicatorProtocol
协议的基类JXCategoryIndicatorComponentView
,里面提供了许多基础属性。点击参看 JXCategoryIndicatorComponentView;Cell 自定义
JXCategoryIndicatorView
、JXCategoryIndicatorCell、
JXCategoryIndicatorCellModel,就像
JXCategoryTitleView、
JXCategoryTitleCell、JXCategoryTitleCellModel
那样去做;JXCategoryTitleImageView
系列、JXCategoryTitleAttributeView
系列那样去做;常用属性说明
常用属性说明文档地址
更新记录
JXCategoryListContainerView
,高度封装列表逻辑,支持懒加载列表,提升初始化性能;- (BOOL)selectCellAtIndex:(NSInteger)index selectedType:(JXCategoryCellSelectedType)selectedType
,自定义有用到该接口的请及时更新。JXCategoryListCollectionContainerView.dataSource
移动到m实现文件,添加- (instancetype)initWithDataSource:(id<JXCategoryListCollectionContainerViewDataSource>)dataSource
初始化方法。- (void)categoryView:(JXCategoryBaseView *)categoryView didClickedItemContentScrollViewTransitionToIndex:(NSInteger)index;
,请使用contentScrollViewClickTransitionAnimationEnabled
属性。JXCategoryTitleVerticalZoomView
进行了重构,内容左边距只需要使用contentEdgeLeft
属性即可。JXCategoryListCollectionContainerView
类新增和必须要调用- (void)scrollingFromLeftIndex:(NSInteger)leftIndex toRightIndex:(NSInteger)rightIndex ratio:(CGFloat)ratio selectedIndex:(NSInteger)selectedIndex
和- (void)didClickSelectedItemAtIndex:(NSInteger)index
两个方法。补充
如果刚开始使用
JXCategoryView
,当开发过程中需要支持某种特性时,请务必先搜索使用文档或者源代码。确认是否已经实现支持了想要的特性。请别不要文档和源代码都没有看,就直接提问,这对于大家都是一种时间浪费。如果没有支持想要的特性,欢迎提Issue讨论,或者自己实现提一个PullRequest。该仓库保持随时更新,对于主流新的分类选择效果会第一时间支持。使用过程中,有任何建议或问题,可以通过以下方式联系我: 邮箱:317437084@qq.com QQ群: 112440473
喜欢就star❤️一下吧
License
JXCategoryView is released under the MIT license.