Latest 0.0.5
Homepage https://github.com/xeroxmx/CBWRefresh
License MIT
Platforms ios 7.0, requires ARC
Authors

CBWRefreshDemo自己写的 refresh

contensize 小于 frame 的情况, footer 默认放在屏幕frame 的底部

install

  1. 使用 pod ‘CBWRefresh’
  2. 直接拖 CBWRefresh 文件夹

usage

1.header
self.tableView.header  = [CBWActivityViewHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
    [self.tableView.header beginRefresh];

- (void)loadMoreData{

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

        //没有更多数据了,直接显示没有更多数据状态
        if (self.count >= 3) {
            [self.tableView.footer endRefreshingWithNoMoreData];
            return ;
        }

        for (int i = 0; i < 10; i ++) {

            NSString *str =  [NSString stringWithFormat:@"%zd++++往后增加的%d",self.bottomIndex,i];
            [self.array addObject:str];
        }

        [self.tableView reloadData];
        [self.tableView.footer endRefresh];

        self.count ++;
        self.bottomIndex ++;
    });
}
2.footer
 self.tableView.footer  = [CBWActivityViewFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)];
- (void)loadMoreData{

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

        //没有更多数据了,直接显示没有更多数据状态
        if (self.count >= 3) {
            [self.tableView.footer endRefreshingWithNoMoreData];
            return ;
        }

        for (int i = 0; i < 10; i ++) {

            NSString *str =  [NSString stringWithFormat:@"%zd++++往后增加的%d",self.bottomIndex,i];
            [self.array addObject:str];
        }

        [self.tableView reloadData];
        [self.tableView.footer endRefresh];

        self.count ++;
        self.bottomIndex ++;
    });
}

/**
 *  footer 重置没有数据
 */
- (void)resetNoMoreData{

    [self.tableView.footer resetNoMoreData];
}

Latest podspec

{
    "name": "CBWRefresh",
    "version": "0.0.5",
    "license": "MIT",
    "homepage": "https://github.com/xeroxmx/CBWRefresh",
    "authors": {
        "codeChenBW": "[email protected]"
    },
    "summary": "A custom Refresh",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/xeroxmx/CBWRefresh.git",
        "tag": "0.0.5"
    },
    "source_files": "CBWRefresh/**/*.{h,m}",
    "resources": "CBWRefresh/CBWRefresh.bundle",
    "requires_arc": true
}

Pin It on Pinterest

Share This