GithubHelp home page GithubHelp logo

sampage / slimerefresh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dbsgen/slimerefresh

0.0 2.0 0.0 381 KB

SlimeRefresh looks like UIRefreshControl in iOS6, SlimeRefresh can also run on iOS4.0 and later , and SlimeRefresh can action on UIScrollView.

License: Other

slimerefresh's Introduction

SlimeRefresh

A lovely refreshing style looks like UIRefreshControl. It looks like the Slime so I named it SlimeRefresh.

Screenshot:

screenshots screenshots screenshots screenshots

How to use?

1,down the source from https://github.com/dbsGen/SlimeRefresh/

  • git : git clone https://github.com/dbsGen/SlimeRefresh.git SlimeRefresh

2,add all under SlimeRefresh/SlimeRefresh to your project.

3,#import "SRRefreshView.h"

4,init SRRefreshView and add it to a UIScrollView.

just like:

    _slimeView = [[SRRefreshView alloc] init];
    _slimeView.delegate = self;
    [_tableView addSubview:_slimeView];

Callback

A protocol and a block, choise one.

- (void)slimeRefreshStartRefresh:(SRRefreshView*)refreshView;

Only one protocol, you have to implement. it will be called when the refreshing will be executed.

and here is the other way:

@property (nonatomic, copy)     SRRefreshBlock  block;

as you see there is a block to receive the refresh event.just like:

__block __unsafe_unretained id this = self;
[refreshView setBlock:^(SRRefreshView* sender) { 
    [this load];    //replace this line to your refreshing code.
}];

Style

  • Change to style of the slime, You have to get the instance of SRSlimeView by this refreshView.slime

    • viscous this property to set how the limit of the slime being pulled apart.
    • radius to set the size of slime.
    • bodyColor to set the fill color.
    • skinColor to set the line color.
  • How to set the arrow image?

    • refreshView.refleshView.image use this to set the arrow image.

Up inset

Some time you maybe want to add the SRRefreshView to a UIScrollView which

have setted the contentInset. At this time you will set the upInset , you

just need to set the top.

Action

  • call scrollViewDidScroll in the protocol scrollViewDidScroll: of UIScrollViewDelegate.
  • call scrollViewDidEndDraging in the scrollViewDidEndDragging:willDecelerate:.
  • and if the refresh loading over you will call endRefresh.

Last

Ok, that is all. Enjoy it, and this is my blog:http://zhaorenzhi.cn.

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.