YAPTR™: Yet another pull-to-refresh. (Compose bar not included. See PHFComposeBarView if you like it.)
contentInset
on the scroll view which I need. Heck not even Apple's own UIRefreshControl respects that property.UIControl
. When triggered it sends a UIControlEventValueChanged
event to targets.The prefered way is to use CococaPods.
pod 'PHFRefreshControl', '~> 1.0.0'
If you can't use CocoaPods for some reason (you really should though, it's the cool kid on the block), then grab the PHFRefreshControl.{h,m}
files and put it in your project. Make sure to add QuartzCore
framework if you haven't already.
Adding a refresh control to a scroll view:
PHFRefreshControl *refreshControl = [PHFRefreshControl new];
[refreshControl setTintColor:tintColor];
[refreshControl addTarget:dataController
action:@selector(reload)
forControlEvents:UIControlEventValueChanged];
[scrollView setRefreshControl:refreshControl];
Triggering a refresh programmatically:
[[scrollView refreshControl] beginRefreshing];
work();
[[scrollView refreshControl] endRefreshing];
PHFRefreshControl
is released under the MIT license.
Philipe Fatio (@fphilipe)
The arrow drawing code was adapted from Sam Vermette's SVPullToRefresh.