Under iOS development pull-up and pull-up loads more 1. Introduction to common drop-down refreshes and pull-up loads more implementations
(1) Uirefreshcontrol
(2) Egotableviewrefresh
(3) Ah3dpullrefresh
(4) Mjrefresh
(5) Self-realization
Use of the 2.ah3dpullrefresh 2.1 configuration
1. Import Ah3dpullrefresh project files
2. In the engineering targets-> Build phases-> Compile sources->
Search for Uiscrollview+ah3dpullrefresh and add "-fno-objc-arc" to the back
3. Add header Uiscrollview+ah3dpullrefresh header file
#import " uiscrollview+ah3dpullrefresh.h "
2.2 Use (example based on a full net)
1. Add drop-down refresh and pull-up load more methods
#pragma Mark drop-down refresh and pull-up load more-(void) addpullrefreshandpullloadmore{ [_tableview Setpulltorefreshhandler:^{ // starting from the first row of data download 1; [Self startdownloaddata]; }]; [_tableview setpulltoloadmorehandler:^{ + = _pagesize; [Self startdownloaddata];} ];}
2. Download the data: If it is a drop-down refresh first clear all the data
// If _offset = 1, refresh again if 1 ) { [_dataarray removeallobjects]; }
End Refresh and Refresh table after loading complete new data
// End Refresh [_tableview refreshfinished]; [_tableview loadmorefinished]; [_tableview Reloaddata];
3. The complete code:
-(void) startdownloaddata{NSString*urlstr =[NSString stringwithformat:main_shop_url,_city,_categotry,_offset,_pagesize]; _reauest=[[HttpRequest alloc]init]; [_reauest requestwithurl:urlstr targe:self Action: @selector (dealdownloadfinish:)];}-(void) Dealdownloadfinish: (HttpRequest *) request{NSString*str =[[NSString Alloc]initwithdata:request.data encoding:nsutf8stringencoding]; NSLog (@"%@", str); Gdataxmldocument*doc = [[Gdataxmldocument alloc]initwithdata:request.data options:0Error:nil]; Nsarray*list = [Doc Nodesforxpath:@"//promotion"Error:nil]; //If _offset = 1, refresh again if(_offset = =1) {[_dataarray removeallobjects]; } for(Gdataxmlelement *promotioninchlist) {Promotionmodel*model =[[Promotionmodel alloc]init]; Model.myid= [[[[Promotion Elementsforname:@"ID"] firstobject] stringvalue]; Model.name= [[[[Promotion Elementsforname:@"name"] firstobject] stringvalue]; [_dataarray Addobject:model]; } //End Refresh[_tableview refreshfinished]; [_tableview loadmorefinished]; [_tableview Reloaddata]; }
Download
Under iOS development pull refresh and pull up load more