Latest 0.0.1
Homepage https://github.com/Baichenghui/BCHRefresh
License MIT
Platforms ios 8.0, requires ARC
Authors

模仿MJRefresh写的一个简单版本的刷新控件

效果

(image)

(image)

安装

pod ‘BCHRefresh’

使用

首先,导入头文件 #import "BCHRefresh.h"

下拉刷新

self.tableView.bch_header = [DIYRefreshHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadData)];

上拉加载更多

self.tableView.bch_footer = [BCHCustomRefreshFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
-(void)loadData{
    self.row = 15;
    __weak typeof(self) weakSelf = self;
    [self.tableView.bch_footer endRefreshing];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
            __strong typeof(self) strongSelf = weakSelf;
            [strongSelf.tableView.bch_header endRefreshing];
            [strongSelf.tableView reloadData];
        });
    });
}

-(void)loadMoreData{ 
    __weak typeof(self) weakSelf = self;
    [self.tableView.bch_header endRefreshing];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_global_queue(0, 0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
            __strong typeof(self) strongSelf = weakSelf;
            [strongSelf.tableView.bch_footer endRefreshing];
            strongSelf.row += 5;
            [strongSelf.tableView reloadData];
        });
    });
}

Latest podspec

{
    "name": "BCHRefresh",
    "version": "0.0.1",
    "summary": "u4e00u4e2au7b80u5355u7248u672cu7684u4e0a/u4e0bu62c9u5237u65b0u63a7u4ef6.",
    "description": "u4e00u4e2au7b80u5355u7248u672cu7684u4e0a/u4e0bu62c9u5237u65b0u63a7u4ef6.u53efu4ee5u5728u539fu6765u7684u57fau7840u4e0au5b9eu73b0u81eau5b9au4e49.u5177u6709u53efu62d3u5c55u6027.",
    "homepage": "https://github.com/Baichenghui/BCHRefresh",
    "license": "MIT",
    "authors": {
        "Coder_Bai": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/Baichenghui/BCHRefresh.git",
        "tag": "0.0.1"
    },
    "source_files": "BCHRefresh/BCHRefresh/*.{h,m}",
    "resources": "BCHRefresh/BCHRefresh/*.{bundle}",
    "requires_arc": true
}

Pin It on Pinterest

Share This