iOS下拉刷新:BMYCircularProgressPullToRefresh
jopen
10年前
BMYCircularProgressPullToRefresh 是下拉刷新,带有圆形进程视图,类似 Beamly iOS 应用。
此版本的下拉刷新特性可以再 UITableViews 和 UICollection 上使用,灵感来源于 Sam Vermette's SVPlullToRefresh。
简单用法:
- 复制在
BMYCircularProgressPullToRefresh
文件夹中的所有类至你的项目中。 - import
BMYCircularProgressPullToRefresh.h
in your (view controller) class - add the pull to refresh feature as so (you probably want to do to in the
viewDidLoad
method):
UIImage *logoImage = [UIImage imageNamed:@"bicon.png"]; UIImage *backCircleImage = [UIImage imageNamed:@"light_circle.png"]; UIImage *frontCircleImage = [UIImage imageNamed:@"dark_circle.png"]; BMYCircularProgressView *progressView = [[BMYCircularProgressView alloc] initWithFrame:CGRectMake(0, 0, 25, 25) logo:logoImage backCircleImage:backCircleImage frontCircleImage:frontCircleImage]; [self.scrollView setPullToRefreshWithHeight:60.0f actionHandler:^(BMYPullToRefreshView *pullToRefreshView){ // reload logic, call the following line when work is done [pullToRefreshView stopAnimating]; }]; [self.scrollView.pullToRefreshView setPreserveContentInset:YES]; [self.scrollView.pullToRefreshView setProgressView:progressView]; - (void)dealloc { [self.scrollView tearDownPullToRefresh]; }