Code Monkey home page Code Monkey logo

bempulltorefreshwp8's Introduction

BEMPullToRefreshWP8

Build Status

Simple Pull to Refresh Control for iOS. Inspired by WP8.

Requirements

  • Requires iOS 6 or later. The sample project is optimized for iOS 7.
  • Requires Automatic Reference Counting (ARC).

License

See the License. You are free to make changes and use this in either personal or commercial projects. Attribution is not required, but it appreciated. A little Thanks! (or something to that affect) would be much appreciated. If you use BEMSimpleLineGraph in your app, let us know. Please note that Microsoft might not be really happy if you use this control as it looks exactly like what is used on Windows Phone.

Contributions

Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.

Sample App

The iOS Sample App included with this project demonstrates how to correctly setup and use BEMPullToRefreshWP8. You can refer to the sample app for an understanding of how to use and setup BEMPullToRefreshWP8.

Installation

To install BEMPullToRefreshWP8 simply drag and drop the PullToRefreshControl folder into your Xcode project. When you do so, check the "Copy items into destination group's folder" box.

Setup

To setup BEMPullToRefreshWP8, follow the steps below.

  1. Import "BEMPullToRefresh.h" to the header of your TableViewController:

      #import "BEMPullToRefresh.h"
    
  2. Implement the BEMPullToRefreshDelegate to the same TableViewController:

      @interface YourViewController : UITableViewController <BEMPullToRefreshDelegate>
    
  3. Add the following code to your implementation (usually the viewDidLoad method).

      BEMPullToRefresh *myPTR = [[BEMPullToRefresh alloc] initWithNumberOfDots:5];
      myPTR.delegate = self;
      [self.view addSubview:myPTR];
    
  4. Call the method viewDidScroll: in scrollViewDidScroll:to inform the control when the view is scrolled by the user.

      - (void)scrollViewDidScroll:(UIScrollView *)scrollView  {
         [self.myPTR viewDidScroll:scrollView];
      }
    
  5. Implement the requiered method Refresh

      - (void)Refresh {
               // Perform here the required actions to refresh the data (call a JSON API for example).
               // Once the data has been updated, call the method isDoneRefreshing:
               [self.myPTR isDoneRefreshing];
      }
    

Properties

The dotColor property controls the color of the dots.

The thresholdToTrigger property controls how far the user needs to pull down the tableview for the refresh to be triggered. A value close to 0 will make it really easy to be triggered while a value above 100 will make it really hard.

The animationSpeed property controls the speed of the dots during the animation. The default value is 1. A value between 0 and 1 will speed up the animation while a value superior to 1 will slow it down.

bempulltorefreshwp8's People

Contributors

boris-em avatar

Watchers

James Cloos avatar IROYCN 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.