phf

PHFRefreshControl

YAPTR™: Yet another pull-to-refresh

Showing:

Popularity

Downloads/wk

0

GitHub Stars

49

Maintenance

Last Commit

8yrs ago

Contributors

2

Package

Dependencies

0

License

MIT

Categories

Readme

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100