Pull refresh and pull-up loading under iOS development

Source: Internet
Author: User

Under iOS development pull refresh and pull-up load 1. Introduction

Common implementation of pull-down refreshes

(1) Uirefreshcontrol

(2) Egotableviewrefresh

(3) Ah3dpullrefresh ( used in this example )

(4) Mjrefresh

(5) Self-realization

2.

Drop-down Refresh

Pull-up loading

3. Code implementation process

3.1 First add Ah3dpullrefresh to project, set UISCROLLVIEW+AH3DPULLREFRESH.M file to non arc (join-FNO-OBJC-ARC)

Add a header file to a. m file that needs to add a drop-down refresh

#import "UISCROLLVIEW+AH3DPULLREFRESH.H"

3.2 is the offset value equals 1 (_offset = 1)and the offset value equals 10+1 (_offset + = _pagesize) Add Load method
    [_tableview setpulltorefreshhandler:^{        // start loading from the first row of data        1;        [Self startdownloaddata];    }];        [_tableview setpulltoloadmorehandler:^{        + = _pagesize;        [Self startdownloaddata];    }];

3.3(1) If the offset value is 1, the data source clears the data;(2) The data from the download library will be extracted and stored in the array list, traversed and assigned within the array list(3) End refresh and refresh TableView data
//if the offset value is 1, refresh the data    if(_offset = =1) {NSLog (@"Drop-down refresh!");    [_dataarray removeallobjects]; } Nsarray*list = [Doc Nodesforxpath:@"//promotion"Error:nil];//iterate through the data and assign values     for(Gdataxmlelement *promotioninchlist) {Promotionmodel*model =[[Promotionmodel alloc] init]; Model.ID= [[[[Promotion Elementsforname:@"ID"] firstobject] stringvalue]; Model.name= [[[[Promotion Elementsforname:@"name"] firstobject] stringvalue];    [_dataarray Addobject:model]; }    //End Refresh[_tableview refreshfinished];        [_tableview loadmorefinished]; [_tableview Reloaddata];

Pull refresh and pull-up loading under iOS development

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.