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