Commit c00e2f4f authored by jz's avatar jz

添加 page

parent eab6bb69
......@@ -98,6 +98,9 @@
/** @brief 获取http数据分页第一页起始位置,默认为0,下一页为startNum+每页的数据条数(默认为10) */
@property (nonatomic,assign) NSInteger startNum;
/** @brief 获取http数据分页第一页起始位置,默认为1,下一页为pag 1 */
@property (nonatomic,assign) NSInteger page;
/** @brief 获取http数据,每页获取数据(默认为10) */
@property (nonatomic,assign) NSInteger count;
......
......@@ -19,6 +19,7 @@
_dataArray = [[NSMutableArray alloc] init];
_startNum = 0;
_page = 1;
_params = nil;
_count = 10;
_deduplicationDic = [NSMutableDictionary dictionary];
......@@ -37,7 +38,8 @@
*/
- (void)buildParams{
_params = @{@"start_num":@(self.startNum),
@"count":@(self.count)};
@"count":@(self.count)
};
}
- (BOOL)shouldClearDataForResponse:(id)response{
......@@ -100,6 +102,7 @@
// 因为 clearData 可能会被外部调用,所以 self.startNum = 0 要确认执行,不能少
self.startNum = 0;
_deleteCount = 0;
_page = 1;
[self.dataArray removeAllObjects];
[_deduplicationDic removeAllObjects];
}
......@@ -107,12 +110,14 @@
- (void)handleHeaderRefreshing
{
self.startNum = 0;
self.page = 1;
[self fetchRemoteData];
}
- (void)handleFooterRereshing
{
self.startNum = self.dataArray.count + _deleteCount;
self.page+=1;
[self fetchRemoteData];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment