|
//
// TPCollectionController.h
// ThePaperHD
//
// Created by scar1900 on 15/1/6.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "TPHttpController.h"
#import "UIScrollView+GifPullToRefresh.h"
static NSString * const collectCellIdentifier = @"collectCellIdentifier";
static NSString * const collectLoadIndentfier = @"collectLoadIndentfier";
#pragma mark - 控件的刷新状态
typedef enum {
RefreshStatePulling = 1, // 松开就可以进行刷新的状态
RefreshStateNormal = 2, // 普通状态
RefreshStateRefreshing = 3, // 正在刷新中的状态
RefreshStateCancel = 4,
RefreshStateSucess = 5,
RefreshStateIsPulling = 6,
RefreshStateNoMore = 7,
RefreshStateFailed = 8
} collectLoadState;
@protocol collectLoadDelegate<NSObject>
@optional
- (void)startLoad;//开始刷新代理
@end
@interface collectLoadView : UICollectionReusableView
@property(nonatomic, strong)UIActivityIndicatorView *activityView;
@property(nonatomic, assign)collectLoadState state;
@property(nonatomic, weak)id<collectLoadDelegate> delegate;
@property(nonatomic, strong)UILabel *textLabel;
@end
@interface TPCollectionController : TPHttpController<UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout,collectLoadDelegate> {
BOOL isCanLoad;
BOOL isCanRefresh;
}
@property(nonatomic, strong)UICollectionView *collectionView;
@property(nonatomic, strong)UICollectionViewFlowLayout *collectionLayout;
@property (nonatomic, strong)NSMutableArray *loadingImgs;
@property (nonatomic, strong)NSMutableArray *drawingImgs;
@property(nonatomic, strong)collectLoadView *loadFooter;
- (id)initWithCollectionViewLayout:(UICollectionViewFlowLayout *)layout;
@property(nonatomic, strong)NSString *nextUrl;
- (void)configCanRefresh:(BOOL)canRefresh canLoad:(BOOL)canLoad;
/*上拉刷新*/
- (void)manualRefresh; //手动调用刷新
- (void)endRefresh:(void (^)(void))animate completion:(void (^)(void))completion; //结束上拉刷新
- (void)pullRefreshHandler; //上拉刷新回调
/*下拉加载*/
- (void)manualLoad; //手动调用加载
- (void)noMoreLoad; //没有更多数据处理
- (void)loadSuccess; //加载成功
- (void)pullLoadMoreHander; //下拉加载回调
@end
|