Skip to content

Commit 9064a67

Browse files
author
乔同X
authored
Update README.md
1 parent de3ed1d commit 9064a67

File tree

1 file changed

+89
-4
lines changed

1 file changed

+89
-4
lines changed

README.md

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# JSLoadMoreServiceDemo
22
[![CocoaPods Compatible](https://img.shields.io/badge/lang-objc-red.svg)](https://github.com/josin22/JSLoadMoreService)
3-
[![CocoaPods Compatible](https://img.shields.io/badge/pod-1.1.0-red.svg)](https://github.com/josin22/JSLoadMoreService)
43
[![CocoaPods Compatible](https://img.shields.io/badge/build-passing-green.svg)](https://github.com/josin22/JSLoadMoreService)
54

65
让预加载,成为你分页的好朋友
@@ -9,10 +8,96 @@
98
![images](https://raw.githubusercontent.com/Josin22/image_source/master/yun_pdlist_preload.gif)
109

1110
# 安装
12-
支持pod 安装
11+
~~支持pod 安装~~
12+
~~pod 'JSLoadMoreService', '~> 1.1.0'~~
13+
14+
更新下:pod安装反而会更麻烦,所以遗弃pod,你可以直接拖着JSLoadMoreService文件到你的项目即可,
15+
16+
#
17+
依赖的三方库有:AFNetworking、ReactiveObjC、YYModel、MJRefresh
18+
# 使用
19+
优雅的建一个viewmodel类,
20+
然后下面就是怎样调用分类的方法:
21+
```- (RACSignal *)siganlForJokeDataIsReload:(BOOL)isReload{
22+
23+
RACReplaySubject *subject = [RACReplaySubject subject];
24+
[[self js_singalForSingleRequestWithURL:Test_Page_URL
25+
para:nil
26+
keyOfArray:@"pdlist"
27+
classNameOfModelArray:@"JSGoodListModel"
28+
isReload:isReload] subscribeNext:^(id _Nullable x) {
29+
/**
30+
* x : 分类方法(js_singalForSingleRequestWithURL:...)里 sendNext 传过来的数组
31+
* 你可以对每次传过来的数组的元素"再加工",知道达到你的要求后 再 sendNext
32+
*/
33+
//...
34+
[subject sendNext:x];
35+
} error:^(NSError * _Nullable error) {
36+
[subject sendError:error];
37+
} completed:^{
38+
/**
39+
* 走到这里为,每次分页请求所有逻辑处理完毕
40+
*/
41+
[subject sendCompleted];
42+
}];
43+
44+
return subject;
45+
}
46+
```
47+
在你的cellForRowAtIndexPath:代理里选择调用回调
48+
```**
49+
* 根据当期index计算是否回调preloadblock
50+
*/
51+
[self preloadDataWithCurrentIndex:indexPath.row];
52+
```
53+
54+
优雅的配置tableview的上拉刷新和预加载
55+
56+
```- (JSListTableView *)listTableView{
57+
58+
if (!_listTableView) {
59+
_listTableView = [[JSListTableView alloc] initWithFrame:self.view.bounds
60+
style:UITableViewStyleGrouped];
61+
[self.view addSubview:_listTableView];
62+
63+
kWeakSelf(self)
64+
/**
65+
* 刷新
66+
*/
67+
[_listTableView headerReloadBlock:^{
68+
kStrongSelf(self)
69+
[self requestGoodListIsReload:YES];
70+
}];
71+
/**
72+
* 预加载
73+
*/
74+
_listTableView.js_preloadBlock = ^{
75+
kStrongSelf(self)
76+
[self requestGoodListIsReload:NO];
77+
};
78+
}
79+
return _listTableView;
80+
}
81+
```
82+
83+
详细的实现步骤请访问[我的博客](http://qiaotongxin.cc/2017/08/06/20170807/)
84+
85+
如果用起来能让你愉悦,别忘记给个star,👍一下~
86+
# JSLoadMoreServiceDemo
87+
[![CocoaPods Compatible](https://img.shields.io/badge/lang-objc-red.svg)](https://github.com/josin22/JSLoadMoreService)
88+
[![CocoaPods Compatible](https://img.shields.io/badge/build-passing-green.svg)](https://github.com/josin22/JSLoadMoreService)
89+
90+
让预加载,成为你分页的好朋友
91+
92+
# 丝滑的样子
93+
![images](https://raw.githubusercontent.com/Josin22/image_source/master/yun_pdlist_preload.gif)
94+
95+
# 安装
96+
~~支持pod 安装~~
97+
~~pod 'JSLoadMoreService', '~> 1.1.0'~~
98+
99+
更新下:pod安装反而会更麻烦,所以遗弃pod,你可以直接拖着JSLoadMoreService文件到你的项目即可,
13100

14-
pod 'JSLoadMoreService', '~> 1.1.0'
15-
16101
#
17102
依赖的三方库有:AFNetworking、ReactiveObjC、YYModel、MJRefresh
18103
# 使用

0 commit comments

Comments
 (0)