Skip to content

An iOS Pull to Refresh View for UIScrollViews and UITableViews.

Notifications You must be signed in to change notification settings

ScottPetit/SPPullView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

What Is It

SPPullView is a simple pull to refresh implementation using a UIScrollView. Similar to refresh views used by the New York Times, Facebook, and Sparrow. Updated for ARC support and based off of Pull To Refresh View. See example image from New York Times app below.

New York Times PullView

How To Get Started

  • Download SPPullView and add SPPullView.h and SPPullView.m to your project
  • Import SPPullView.h to your class
  • Create an instance variable for SPPullView in your classes .h like this and synthesize it in your .m
  • In your viewDidLoad (or wherever you'd like) create the PullView and pass in the UIScrollView you are using

SPPullView now has a style property (PullViewStyleDefault and PullViewStyleSimple) that can be passed in init to change the style of the PullView. If you don't pass in a property it will just load the default Style. However the new styles can be accessed as such:

self.pullView = [SPPullView pullViewWithScrollView:self.scrollView andStyle:PullViewStyleSimple];

PullViewStyleSimple is simply cosmetic changes, such as the removal of the last updated method. Also it replaces the loading text with the Activity View.

self.pullView = [SPPullView pullViewWithScrollView:self.scrollView];
  • You'll need to add yourself as a delegate of SPPullView so that you can be notified when you should refresh your data. The only method is
- (void) pullViewShouldRefresh:(SPPullView *) view;

This is called when the user has dragged the pull view to the refresh point and released.

  • Then just add the pullView to your UIScrollView
[self.scrollView addSubview:self.pullView];
  • The only thing you need to worry about is letting the PullView know when your data is done loading, just as simple as calling
[self.pullView finishedLoading];

Delegate Methods

//Called when the user pulls to refresh (this is when you should update your data)
- (void) pullViewShouldRefresh: (SPPullView *) view;

About

An iOS Pull to Refresh View for UIScrollViews and UITableViews.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published