Code Monkey home page Code Monkey logo

odrefreshcontrol's Introduction

__*Notice:* There’s a new 2.0 branch where I updated the control for iOS7 plus I plan to do some interesting new features. If people could try it out so I can be sure I didn’t break anything it’d be great, and report any issue you find, I’d really appreciate that :)

ODRefreshControl

ODRefreshControl is a “pull down to refresh” control for UIScrollView, like the one Apple introduced in iOS6, but available to anyone from iOS4 and up.

Installation

  • Drag the ODRefreshControl/ODRefreshControl folder into your project.
  • Add the QuartzCore framework to your project.
  • #import "ODRefreshControl.h"

Important note if your project doesn’t use ARC: you must add the -fobjc-arc compiler flag to ODRefreshControl.m in Target Settings > Build Phases > Compile Sources.

Usage

(see sample Xcode project in /Demo)

Adding a refresh control to your table view

ODRefreshControl *refreshControl = [[ODRefreshControl alloc] initInScrollView:self.scrollView];

To know when the refresh operation has started, add an action method to the UIControlEventValueChanged event of the control

[refreshControl addTarget:self action:@selector(dropViewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged];

If you’d like to programmatically start the refresh operation, use

[refreshControl beginRefreshing];

Remember to tell the control when the refresh operation has ended

[refreshControl endRefreshing];

Customization

The ODRefreshControl can be customized using the following properties:

@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorViewStyle;
@property (nonatomic, strong) UIColor *activityIndicatorViewColor; // iOS5 or more

Credits

ODRefreshControl is brought to you by Fabio Ritrovato and contributors to the project. If you have feature suggestions or bug reports, feel free to help out by sending pull requests or by creating new issues. If you’re using ODRefreshControl in your project, attribution would be nice.

odrefreshcontrol's People

Contributors

sephiroth87 avatar lexrus avatar msnexploder avatar fernandonf avatar jwhitehorn avatar jwilling avatar nicklockwood avatar dongminkim avatar

Watchers

 avatar  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.