FCXRefresh是一个使用OC编写、用于上下拉刷新的控件。
- 普通上下拉刷新
- 自动下拉刷新
- 上拉无更多数据控制
- 上下拉百分比显示
- 自定义上下拉动画
- 上拉底部间距控制
- Xcode 11+
- iOS 8.0+
pod 'FCXRefresh'
github "FCXPods/FCXRefresh"
把FCXRefresh文件夹导入即可
#import "UIScrollView+FCXRefresh.h"
//下拉刷新
_refreshHeaderView = [self.tableView addHeaderWithRefreshHandler:^(FCXRefreshBaseView *refreshView) {
[weakSelf refreshAction];
}];
//上拉加载更多
_refreshFooterView = [self.tableView addFooterWithRefreshHandler:^(FCXRefreshBaseView *refreshView) {
[weakSelf loadMoreAction];
}];
//自动下拉刷新
[_refreshHeaderView autoRefresh];
//自动上拉加载更多
_refreshFooterView.autoLoadMore = YES;
//上拉底部间距设置
_refreshFooterView.loadMoreBottomExtraSpace = 30;
_refreshHeaderView.pullingPercentHandler = ^(CGFloat pullingPercent) {
headerPercentLabel.text = [NSString stringWithFormat:@"%.2f%%", pullingPercent * 100];
};
_refreshFooterView.pullingPercentHandler = ^(CGFloat pullingPercent) {
footerPercentLabel.text = [NSString stringWithFormat:@"%.2f%%", pullingPercent * 100];
};
FCXRefresh is released under the MIT license. See LICENSE for details.