高仿闲鱼、转转、京东、中央天气预报等主流APP列表底部分页滚动视图
高仿闲鱼、转转、京东、中央天气预报等主流APP列表底部分页滚动视图
说明 | GIF |
---|---|
上下左右交互 | |
MJRefresh刷新加载 | |
HUD loading加载 | |
保存底部列表滚动状态 | |
不保存底部列表滚动状态 | |
JXPagingView 如果只需要HeaderView 请点击查看该库JXPagingView 请点击查看该库JXPagingView 请点击查看该库JXPagingView |
pageListView
self.pageListView = [[JXPageListView alloc] initWithDelegate:self];
pinCategoryView
self.pageListView.pinCategoryView.titles = self.titles;
self.pageListView.mainTableView.dataSource = self;
self.pageListView.mainTableView.delegate = self;
UITableViewDataSource, UITableViewDelegate
代理方法实现- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1 + “你的顶部内容section数量”;//底部的分类滚动视图需要作为最后一个section
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 2) {
//Tips:最后一个section(即listContainerCell所在的section)需要返回1
return 1;
}
//返回你的顶部内容 row number
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 2) {
//Tips:最后一个section(即listContainerCell所在的section)返回listContainerCell的高度
return [self.pageListView listContainerCellHeight];
}
//返回你的顶部内容 cell height
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 2) {
//Tips:最后一个section(即listContainerCell所在的section)配置listContainerCell
return [self.pageListView listContainerCellForRowAtIndexPath:indexPath];
}
//返回你的顶部内容 cell
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
//Tips:需要传入mainTableView的scrollViewDidScroll事件
[self.pageListView mainTableViewDidScroll:scrollView];
}
JXPageViewDelegate
代理方法实现//返回底部的列表视图
- (NSArray<UIView<JXPageListViewListDelegate> *> *)listViewsInPageListView:(JXPageListView *)pageListView {
return self.listViewArray;
}
如果你只想找一个顶部只有少量视图(类似TableHeaderView的概念),推荐你看我的这个库:JXPagingView
如果你想要支持所有主流APP分类切换效果的框架,推荐你看我的这个库,目前已经1.4k stars:JXCategoryView
有任何疑问欢迎通过以下方式联系我: