iOS development TableView Two-level linkage details of the implementation of attention to detail summary

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.