如何直接使用XHRefreshControl?
heyehao2008 opened this issue · comments
看你的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];
}
这样使用是否正确呢?
你好! 只需要初始化,然后实现你需要的Delegate就可以了
我准备写一个分类来处理这个问题,以后可能就比较方便了