First, the data display problem caused by slow network
You can refresh the TableView by judging whether the request parameters are consistent.
Sjbcategarymodel * Categarymodel = Self.categarys[categaryselectrow];
Nsmutabledictionary * params = [nsmutabledictionary dictionary];
Categarymodel.currentpage = 1;
Params[@ "a"] = @ "List";
params[@ "C"] = @ "Subscribe";
params[@ "category_id"] = @ (categarymodel.id);
params[@ "page"] = @ (categarymodel.currentpage);
Self.params = params;
[Self.manager get:main_url parameters:params progress:^ (nsprogress * _nonnull downloadprogress) {
} success:^ (Nsurlsessiondatatask * _nonnull task, id _nullable responseobject) {
if (self.params! = params) return;
[Categarymodel.userarrm removeallobjects];
for (int i=0; i<[responseobject[@ "List"] count]; i++) {
Sjbusermodel * model = [[Sjbusermodel alloc] init];
[Model setvaluesforkeyswithdictionary:responseobject[@ "list"][i]];
[Categarymodel.userarrm Addobject:model];
}
Categarymodel.total = [responseobject[@ "Total"] integervalue];
[Self.usertableview Reloaddata];
[Self.userTableView.mj_header endrefreshing];
[Self checktablefooterstate];
} failure:^ (Nsurlsessiondatatask * _nullable task, Nserror * _nonnull error) {
[Self.userTableView.mj_header endrefreshing];
}];
Footer display inconsistent issues when loading
if (!self.categarys.count) {
Return
}
Sjbcategarymodel * Categarymodel = Self.categarys[categaryselectrow];
Self.userTableView.mj_footer.hidden = (CategaryModel.userArrM.count = = 0);
if (CategaryModel.userArrM.count = = categarymodel.total) {
[Self.userTableView.mj_footer Endrefreshingwithnomoredata];
}else{
[Self.userTableView.mj_footer endrefreshing];
}
If the amount of data requested is equal to the total amount, no more data is displayed, and if the amount is less than the total, click or pull-up loads more data.
iOS development TableView Two-level linkage details of the implementation of attention to detail summary