All Projects → fphilipe → PHFRefreshControl

fphilipe / PHFRefreshControl

Licence: MIT license
YAPTR™: Yet another pull-to-refresh

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

PHFRefreshControl

YAPTR™: Yet another pull-to-refresh. (Compose bar not included. See PHFComposeBarView if you like it.)

image

Why?

  • Other existing solutions were quite complex and often implement an infinite scroll thingy and a last refresh date which I don't need.
  • These also often don't work correctly if you use a top contentInset on the scroll view which I need. Heck not even Apple's own UIRefreshControl respects that property.

Features

  • No need to pull and release. Just pull far enough and a refresh will trigger. You'll see much more of these soon.
  • Adjust tint color of arrow.
  • No support for last refresh date.
  • Built on top of UIControl. When triggered it sends a UIControlEventValueChanged event to targets.
  • View has a magical height of 44 points.
  • iOS 5 and up (yeah, that's a feature).

Installation

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.

Usage

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];

Small Print

License

PHFRefreshControl is released under the MIT license.

Author

Philipe Fatio (@fphilipe)

Credits

The arrow drawing code was adapted from Sam Vermette's SVPullToRefresh.

Bitdeli Badge

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].