https://github.com/samvermette/SVPullToRefresh
上述URL可以下载此类,很好地实现了下拉刷新、上拉加载的功能;
可以用于一个scrollview上有多个tableview的情形。
只需增加几行代码,就能用于自己的程序,比如:
//下拉刷新
- (void)insertTodayAtTop
{
__weak SHViewController *weakSelf = self;
float delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
DLog(@"XIALASHUAXIN");
[self refreshToday];
});
}
//上拉加载
- (void)insertTodayAtBottom
{
__weak SHViewController *weakSelf = self;
float delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self loadToday];
[weakSelf.todayTableView.infiniteScrollingView stopAnimating];
});
}