Giter VIP home page Giter VIP logo

sppullview's Introduction

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;

sppullview's People

Contributors

scottpetit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.