IOS15 上拉加载更多数据在数据叠加
IOS15 上拉加载更多数据在数据叠加
-(void)loadMoreStatuses{
AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
NSMutableDictionary *params = [NSMutableDictionary dictionary];
params[@"access_token"] = [HMAccountTool account].access_token;
HMStatus *lastStatus = [self.statuses lastObject];
if(lastStatus) {
params[@"max_id"] = @([lastStatus.idstr longLongValue]-1);
}
[mgr GET:@"https://api.weibo.com/2/statuses/home_timeline.json" parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSArray *statusDictArray= responseObject[@"statuses"];
NSArray *newStatuses = [HMStatus mj_objectArrayWithKeyValuesArray:statusDictArray];
[self.statuses addObjectsFromArray:newStatuses];
[self.tableView reloadData];
[self.footer endRefreshing];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"%@",error);
[self.footer endRefreshing];
}];
}
本文标题:IOS15 上拉加载更多数据在数据叠加
本文链接:https://www.haomeiwen.com/subject/qvzxqrtx.html
网友评论