您的位置:首页 > 移动开发 > IOS开发

实现下拉刷新效果 IOS所有版本均可使用

2012-11-27 22:15 639 查看
先上图,没图没真相









下拉刷新效果使用第三方类库

ODRefreshControl

例子目录结构:

Resources    资源文件夹

ThirdPartLib   第三方类库文件夹

直接上核心调用代码,一共只有六句,简单好用。

设置下拉刷新的位置

V_animateIndicator *v = [[V_animateIndicator alloc] initWithFrame:CGRectMake(0.f, 0.f, 20.f, 20.f)];
ODRefreshControl *refreshControl = [[ODRefreshControl alloc] initInScrollView:self.pTV_main activityIndicatorView:v];
[refreshControl addTarget:self action:@selector(dropViewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];


下拉刷新后会调用的方法

- (void)dropViewDidBeginRefreshing:(ODRefreshControl *)refreshControl
{
double delayInSeconds = 3.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
//下拉刷新后执行的操作 Start
[self refreshCell];
//下拉刷新后执行的操作 End
[refreshControl endRefreshing];
});
}


PRJ_pullDownRefresh.zip 例子代码地址:http://ishare.iask.sina.com.cn/f/34837888.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: