| 测试已测试 | ✗ |
| Lang语言 | Obj-CObjective C |
| 许可证 | MIT |
| 发布最后发布 | 2016年11月 |
由Ivan Ziryanov维护。
| 依赖 | |
| UIView+TKGeometry | >= 0 |
| JRSwizzle | >= 0 |
这些 UIScrollView 分类使得将无限滚动功能添加到任何 UIScrollView(或其子类)变得非常容易。CCInfiniteScrolling 通过 Objective-C 运行时,向 UIScrollView 添加以下 2 个方法,而非依赖于代理和/或子类化 UIViewController
- (void)addTopInfiniteScrollingWithActionHandler:(void (^)())actonHandler;
- (void)addBottomInfiniteScrollingWithActionHandler:(void (^)())actonHandler;CocoaPods 是推荐将 CCInfiniteScrolling 添加到您项目的做法。
以下是一个安装 CCInfiniteScrolling 的示例 podfile。
platform :ios, '6.0'
pod 'CCInfiniteScrolling'(请参见 /Example 目录中的示例 Xcode 代码库)
[_tableView addBottomInfiniteScrollingWithActionHandler:^{
//this block will be triggered when user has scrolled to bottom of tableview;
//you can start "load more" request
//simply call [_tableView reloadData] when your request finishes
}];您可以通过设置 infiniteScrollingDisabled 属性来临时禁用无限滚动视图
tableView.infiniteScrollingDisabled = YES;可以使用以下方法对无限滚动视图进行自定义
@property (nonatomic) IBOutlet UIView *infiniteScrollingCustomView;
@property (nonatomic) IBOutlet UIView *infiniteScrollingCustomFailedView;
+ (void)setInfinityScrollingCustomBlockFailedImage:(UIImage *)image;
@property (nonatomic) IBOutlet UIView *topInfiniteScrollingCustomView;
@property (nonatomic) IBOutlet UIView *bottomInfiniteScrollingCustomView;
@property (nonatomic) IBOutlet UIView *topInfiniteScrollingCustomFailedView;
@property (nonatomic) IBOutlet UIView *bottomInfiniteScrollingCustomFailedView;
@property (nonatomic) BOOL topInfiniteScrollingDisabled;
@property (nonatomic) BOOL bottomInfiniteScrollingDisabled;
@property (nonatomic) BOOL topInfiniteScrollingBlockFailed;
@property (nonatomic) BOOL bottomInfiniteScrollingBlockFailed;