GithubHelp home page GithubHelp logo

dbsgen / slimerefresh Goto Github PK

View Code? Open in Web Editor NEW
383.0 25.0 77.0 446 KB

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

License: Other

Objective-C 98.99% C 1.01%

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

screenshots

screenshots

screenshots

Usage

1,download 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

  • Refere to the demo.

  • The reflesh arrow image :

    • refreshView.refleshView.image = [UIImage imaggeNamed:@"Yours"];
    • refreshView.refreshView.bounds = CGRectMake(0, 0, 23, 23);
    • I'm sorry, it is not a good name.

Bug

  • When in the animation the view controller dealloc, that will make application creash.
    • Use the last version and remove refreshView from it's super view, when view controller dealloced.
- (void)dealloc { [refreshView removeFromSuperview]; }

Others

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

slimerefresh's People

Contributors

dbsgen avatar ivoryxiong avatar phektus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slimerefresh's Issues

leaving gap without UINavigationBar

this is very weird, in the demo, i manually hide the nav bar, and when i pull down i will have to pull far enough to get the slime visible, seems like the same height as nav bar

and when the activity animation finished, the table will not get back to where table originally would be
[_slimeView update:64];
it'll go back to above value setup to update when slimeview init.

i have to giveup the component, but awesome animation anyway, if only it'll also work without Nav bar

add a .gitignore

add file .gitignore to the root
file content:

build
_xcodeproj/_mode*
_xcodeproj/_pbxuser
_xcodeproj/_per*
xcodeproj/project.xcworkspace
*xcodeproj/xcuserdata
*tmproj
.DS_Store
profile
*.pbxuser
*.mode1v3
External/GHUnit/

*.swp
*.swo
*.xcuserstate

it is crashing

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = NSLocalizedString(@"xxxx", nil);

    self.baobaoContentView.delegate = self;
    self.slimeView = [[SRRefreshView alloc] initWithHeight:32.f];
    self.slimeView.delegate = self;
    self.slimeView.upInset = 44;
    self.slimeView.slimeMissWhenGoingBack = YES;
    self.slimeView.slime.bodyColor = [UIColor blackColor];
    self.slimeView.slime.skinColor = [UIColor whiteColor];
    self.slimeView.slime.lineWith = 1;
    self.slimeView.slime.shadowBlur = 4;
    self.slimeView.slime.shadowColor = [UIColor blackColor];
    [self.baobaoContentView addSubview:self.slimeView];

}

the scrollview is xib outlet, and build in Xcode 6

block will cause crash

setting block instead of delegate will cause the crash while scrolling down quickly while refresh action is triggered & not finished, most probably the block is being released when slime view is out of the screen

可能导致 TableView 或者 ScrollView 无法释放的问题

我注意到SRRefreshView.m文件中
@property (nonatomic, strong) UIScrollView *scrollView;
这会和 ScrollView 形成循环强引用,导致无法释放,频繁操作将导致内存泄漏。
如果 Cell 内使用了观察者,将导致观察者引起的 Crash。

Sticky Section header when scrolling down while refreshing

When the control is in "refresh mode" and you scroll down the table view a sticky section header will float not at the top of the screen like it normally does.
It will float offset to the bottom by the height of the refresh control even though the refresh control has scrolled out of sight.

一个可能导致 Crash 的问题

我注意到在SRRefreshView.h文件中
@property (nonatomic, assign) id<SRRefreshDelegate> delegate;
使用了 assign 修饰 object。如果 delegate 指向的对象释放,assign并不能自动置为nil,此时再向 delegate 发送消息,则会 crash。俗称野指针。

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.