IOS development pull-down refresh and pull-up loading more, ios Loading
Pull-down refresh and pull-up loading for iOS development
1. Introduction
Common implementation methods of pull-down refresh
(1) UIRefreshControl
(2) EGOTableViewRefresh
(3) AH3DPullRefresh
(4) MJRefresh
(5) self-implementation
2. Use UIScrollView + PullLoad 2.1
Pull-down Refresh:
Pull up to load more:
2.2 Implementation
Step 1: Add UIScrollView + PullLoad. m to the project and set UIScrollView + PullLoad. m to a non-ARC (add-fno-objc-arc)
Add the header file to the. m file to be refreshed from the drop-down list.
# Import "UIScrollView + PullLoad. h"
Step 2: Add drop-down refresh and pull up more for the table View
-(Void) PullDownLoadEnd {_ count = 1; _ tableView. canPullUp = YES; [self startDownloadData]; [_ tableView reloadData]; [_ tableView stopLoadWithState: PullDownLoadState];}-(void) PullUpLoadEnd {_ count + = 1; if (_ count> 10) {_ tableView. canPullUp = NO;} [self startDownloadData]; [_ tableView reloadData]; [_ tableView stopLoadWithState: PullUpLoadState];}
* Note:
if(self.interceptor.downView)// [self.interceptor.downView setFrame:CGRectMake(0, self.contentSize.height, self.frame.size.width, 300)]; [self.interceptor.downView setFrame:CGRectMake(0, self.contentSize.height - 140 - 64 - 49, self.frame.size.width, 300 - 140 - 64 - 49)];
When this class is used for drop-down loading, the view displayed by default is the entire self. view, that is:
[self.interceptor.downView setFrame:CGRectMake(0, self.contentSize.height, self.frame.size.width, 300)];
Change:
[self.interceptor.downView setFrame:CGRectMake(0, self.contentSize.height - 140 - 64 - 49, self.frame.size.width, 300 - 140 - 64 - 49)];
Is suitable for the current program.