Latest 0.8.0
Homepage https://github.com/SmallElephant/FERefresh
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors

最简单的下拉刷新,自定义视图,轻松解耦

Header and Footer Refresh for UIScrollView

HeaderRefresh(头部刷新)

self.headerRefresh=[[FEHeaderRefresh alloc]initWithScrollView:self.tableView];
[self.headerRefresh setUpRefreshView:@"FENormalHeaderView"];
__weak FEHeaderRefresh *weakHeaderRefresh=self.headerRefresh;
__weak typeof(self) weakSelf=self;
[self.headerRefresh addRefreshingBlock:^{
    dispatch_time_t delayTime=dispatch_time(DISPATCH_TIME_NOW, 2*NSEC_PER_SEC);

    dispatch_after(delayTime, dispatch_get_main_queue(), ^{
        for (NSInteger i=100;i<110 ;i++) {
            [weakSelf.dataSource addObject:[NSString stringWithFormat:@"FlyElephant-%ld",(long)i]];
        }
        [weakSelf.tableView reloadData];
        [weakHeaderRefresh stopRefreshing];
    });
}];

FooterRefresh(底部刷新)

self.footerRefresh=[[FEFooterRefresh alloc]initWithScrollView:self.tableView];
[self.footerRefresh setUpRefreshView];
__weak FEFooterRefresh *weakFooterRefresh=self.footerRefresh;
[self.footerRefresh addRefreshingBlock:^{
    dispatch_time_t delayTime=dispatch_time(DISPATCH_TIME_NOW, 2*NSEC_PER_SEC);
    dispatch_after(delayTime, dispatch_get_main_queue(), ^{
        for (NSInteger i=100;i<110 ;i++) {
            [weakSelf.dataSource addObject:[NSString stringWithFormat:@"FlyElephant-%ld",(long)i]];
        }
        [weakSelf.tableView reloadData];
        [weakFooterRefresh stopRefreshing];
    });
}];

Custom RefreshView

Two Step:

  • Inheritance FERefreshView(继承FERefreshView)
  • setupRefreshView(刷新的时候设置自定View的名字即可)
    
    -(void)setUpRefreshView:(NSString *)refreshClass;
    

Through FERefresh update Custom View:

typedef NS_ENUM(NSUInteger,FERefreshState){
    FERefreshStateBegin=0,//初始化
    FERefreshStateRefresing,//刷新
    FERefreshStateTransition,//临界值
    FERefreshStateDragRepeat,//反复拉动
    FERefreshStateEnd//结束
};

Dynamic effect diagram(动态效果图)

image

Podfile

pod 'FERefresh'

Latest podspec

{
    "name": "FERefresh",
    "version": "0.8.0",
    "summary": "Header and Footer Refresh for UIScrollView in iOS.",
    "homepage": "https://github.com/SmallElephant/FERefresh",
    "license": "MIT",
    "authors": {
        "FlyElephant": "[email protected]"
    },
    "social_media_url": "http://www.jianshu.com/users/24da48b2ddb3/latest_articles",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/SmallElephant/FERefresh.git",
        "tag": "0.8.0"
    },
    "source_files": "FERefresh/utils/*.{h,m}",
    "frameworks": "UIKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This