Git Product home page Git Product logo

xhrefreshcontrol's Issues

使用方法不清晰,希望更新文档

运行demo感觉定制型很高,但是demo写的有点乱,文档也很简单。当继承UITableViewController或UIViewController时该如何具体操作?是直接继承XHSystemTableViewController还是如何,有点迷惑。

XHDemoTableViewController在两页数据条件下loadmore按钮和tableview重叠

将XHDemoTableViewController.m的loadDataSource做如下修改:

1)去掉sleep(1.5), 模拟后台数据快速加载
2)修改为requestCurrentPage==2时,调用endMoreOverWithMessage。

快速pull up, 结果loadmore按钮和tableview重叠.

- (void)loadDataSource{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         NSMutableArray *dataSource = [[NSMutableArray alloc] initWithObjects:
                                  @"请问你现在在哪里啊?我在广州天河",
                                  @"请问你现在在哪里啊?我在广州天河",
                                  @"请问你现在在哪里啊?我在广州天河",
                                  @"请问你现在在哪里啊?我在广州天河",

    NSMutableArray *indexPaths;
    if (self.requestCurrentPage) {
        indexPaths = [[NSMutableArray alloc] initWithCapacity:dataSource.count];
        [dataSource enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
            [indexPaths addObject:[NSIndexPath indexPathForRow:self.dataSource.count + idx inSection:0]];
        }];
    }
    //sleep(1.5);
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self.requestCurrentPage) {
            if (self.requestCurrentPage == 2) {
                [self endMoreOverWithMessage:@"段子已加载完"];
            } else {

                [self.dataSource addObjectsFromArray:dataSource];
                [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
                [self endLoadMoreRefreshing];
            }
        } else {
            if (rand() % 3 > 1) {
                self.loadMoreRefreshed = NO;
            }

            self.dataSource = dataSource;
            [self.tableView reloadData];
            [self endPullDownRefreshing];
        }
    });

直接导入RefreshControl使用出现编译错误

直接导入RefreshControl文件夹到项目之后,编译会在XHRefreshControl.h 等文件里面出现 "Expected a type" 这样的错误提示。

需要在XHRefreshControl.h里面#import <UIKit/UIKit.h>才能让编译通过。

如何直接使用XHRefreshControl?

看你的demo,都是重写了uitableViewController,能否直接使用XHRefreshControl。
我试了一下,有很多问题,不知道我的方法对不对:
UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds];
tableView.delegate = self;
tableView.dataSource = self;
[self.view addSubview:tableView];

_customRefresh = [[XHRefreshControl alloc]initWithScrollView:tableView delegate:self];
_customRefresh.circleColor = Navigation_Title_Color;
_customRefresh.circleLineWidth = 1;

实现delegate:
-(void)beginPullDownRefreshing{
NSLog(@"刷新数据");
[self performSelector:@selector(endRefreshing) withObject:nil afterDelay:5];
}

-(void)beginLoadMoreRefreshing{
NSLog(@"加载更多");
}

-(XHRefreshViewLayerType)refreshViewLayerType{
return XHRefreshViewLayerTypeOnScrollViews;
}

-(XHPullDownRefreshViewType)pullDownRefreshViewType{
return XHPullDownRefreshViewTypeCircle;
}

  • (void)endRefreshing{
    [self.customRefresh endPullDownRefreshing];
    }

这样使用是否正确呢?

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.