xhzengaib / xhrefreshcontrol Goto Github PK
View Code? Open in Web Editor NEWXHRefreshControl 是一款高扩展性、低耦合度的下拉刷新、上提加载更多的组件。
License: MIT License
XHRefreshControl 是一款高扩展性、低耦合度的下拉刷新、上提加载更多的组件。
License: MIT License
加载更多 难用
运行demo感觉定制型很高,但是demo写的有点乱,文档也很简单。当继承UITableViewController或UIViewController时该如何具体操作?是直接继承XHSystemTableViewController还是如何,有点迷惑。
when I used in UIViewController draw Circle is wrong
2.5
将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];
}
});
我工程是继承XHSysatemRefreshTableViewController,最开始显示的cell数量很少,这时我想让XHSysatemRefreshTableViewController无法上拉,当cell数量能够充满整个屏幕或更多时,才能够上拉加载,应该怎么实现呢
直接导入RefreshControl文件夹到项目之后,编译会在XHRefreshControl.h 等文件里面出现 "Expected a type" 这样的错误提示。
需要在XHRefreshControl.h里面#import <UIKit/UIKit.h>才能让编译通过。
如题。谢谢 看过你的demo 是我看过最好的。
看你的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;
}
这样使用是否正确呢?
你好,你的库是否支持swift呢?
手动调用startPullDownRefreshing 不出现下拉动画效果。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.