简单的UIScrollView 下拉刷新

这里只贴主要代码

#import "ViewController.h"
@interface ViewController ()<UIScrollViewDelegate>{
UIView * _loadView;
} - (void)viewDidLoad {
_loadView = [[UIView alloc] initWithFrame:CGRectMake(, -, , )];
//...
} #pragam mark UIScrollView Delegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
_loadView.frame = CGRectMake(, - - scrollView.contentOffset.y, , );
if (scrollView.contentOffset.y<= -) {
//处理松开刷新提示
} else {
//关闭松开刷新提示
}
} - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (scrollView.contentOffset.y<= -) {
//此处动画纯粹为了过度平滑
[UIView animateWithDuration:0.2 animations:^(void) {
scrollView.contentInset = UIEdgeInsetsMake(, , , );
}completion:^(BOOL complete) {
//处理需要加载的东西
}];
}
} //...
上一篇:基于AngularJs的上传控件-angular-file-upload


下一篇:Python Scrapy环境配置教程+使用Scrapy爬取李毅吧内容