Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何直接使用XHRefreshControl? #18

Open
RondaHo opened this issue Dec 17, 2014 · 2 comments
Open

如何直接使用XHRefreshControl? #18

RondaHo opened this issue Dec 17, 2014 · 2 comments

Comments

@RondaHo
Copy link

RondaHo commented Dec 17, 2014

看你的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];
    }

这样使用是否正确呢?

@xhzengAIB
Copy link
Owner

你好! 只需要初始化,然后实现你需要的Delegate就可以了

@xhzengAIB
Copy link
Owner

我准备写一个分类来处理这个问题,以后可能就比较方便了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants