//  浠g爜鍦板潃: https://github.com/CoderMJLee/MJRefresh
//  浠g爜鍦板潃: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
//  MJRefreshComponent.h
//  MJRefreshExample
//
//  Created by MJ Lee on 15/3/4.
//  Copyright (c) 2015骞?灏忕爜鍝? All rights reserved.
//  鍒锋柊鎺т欢鐨勫熀绫?
#import <UIKit/UIKit.h>
#import "MJRefreshConst.h"
#import "UIView+MJExtension.h"
#import "UIScrollView+MJExtension.h"
#import "UIScrollView+MJRefresh.h"

/** 鍒锋柊鎺т欢鐨勭姸鎬?*/
typedef NS_ENUM(NSInteger, MJRefreshState) {
    /** 鏅€氶棽缃姸鎬?*/
    MJRefreshStateIdle = 1,
    /** 鏉惧紑灏卞彲浠ヨ繘琛屽埛鏂扮殑鐘舵€?*/
    MJRefreshStatePulling,
    /** 姝e湪鍒锋柊涓殑鐘舵€?*/
    MJRefreshStateRefreshing,
    /** 鍗冲皢鍒锋柊鐨勭姸鎬?*/
    MJRefreshStateWillRefresh,
    /** 鎵€鏈夋暟鎹姞杞藉畬姣曪紝娌℃湁鏇村鐨勬暟鎹簡 */
    MJRefreshStateNoMoreData
};

/** 杩涘叆鍒锋柊鐘舵€佺殑鍥炶皟 */
typedef void (^MJRefreshComponentRefreshingBlock)();

/** 鍒锋柊鎺т欢鐨勫熀绫?*/
@interface MJRefreshComponent : UIView
{
    /** 璁板綍scrollView鍒氬紑濮嬬殑inset */
    UIEdgeInsets _scrollViewOriginalInset;
    /** 鐖舵帶浠?*/
    __weak UIScrollView *_scrollView;
}
#pragma mark - 鍒锋柊鍥炶皟
/** 姝e湪鍒锋柊鐨勫洖璋?*/
@property (copy, nonatomic) MJRefreshComponentRefreshingBlock refreshingBlock;
/** 璁剧疆鍥炶皟瀵硅薄鍜屽洖璋冩柟娉?*/
- (void)setRefreshingTarget:(id)target refreshingAction:(SEL)action;
/** 鍥炶皟瀵硅薄 */
@property (weak, nonatomic) id refreshingTarget;
/** 鍥炶皟鏂规硶 */
@property (assign, nonatomic) SEL refreshingAction;
/** 瑙﹀彂鍥炶皟锛堜氦缁欏瓙绫诲幓璋冪敤锛?*/
- (void)executeRefreshingCallback;

#pragma mark - 鍒锋柊鐘舵€佹帶鍒?/** 杩涘叆鍒锋柊鐘舵€?*/
- (void)beginRefreshing;
/** 缁撴潫鍒锋柊鐘舵€?*/
- (void)endRefreshing;
/** 鏄惁姝e湪鍒锋柊 */
- (BOOL)isRefreshing;
/** 鍒锋柊鐘舵€?涓€鑸氦缁欏瓙绫诲唴閮ㄥ疄鐜?*/
@property (assign, nonatomic) MJRefreshState state;

#pragma mark - 浜ょ粰瀛愮被鍘昏闂?/** 璁板綍scrollView鍒氬紑濮嬬殑inset */
@property (assign, nonatomic, readonly) UIEdgeInsets scrollViewOriginalInset;
/** 鐖舵帶浠?*/
@property (weak, nonatomic, readonly) UIScrollView *scrollView;

#pragma mark - 浜ょ粰瀛愮被浠幓瀹炵幇
/** 鍒濆鍖?*/
- (void)prepare NS_REQUIRES_SUPER;
/** 鎽嗘斁瀛愭帶浠秄rame */
- (void)placeSubviews NS_REQUIRES_SUPER;
/** 褰搒crollView鐨刢ontentOffset鍙戠敓鏀瑰彉鐨勬椂鍊欒皟鐢?*/
- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change NS_REQUIRES_SUPER;
/** 褰搒crollView鐨刢ontentSize鍙戠敓鏀瑰彉鐨勬椂鍊欒皟鐢?*/
- (void)scrollViewContentSizeDidChange:(NSDictionary *)change NS_REQUIRES_SUPER;
/** 褰搒crollView鐨勬嫋鎷界姸鎬佸彂鐢熸敼鍙樼殑鏃跺€欒皟鐢?*/
- (void)scrollViewPanStateDidChange:(NSDictionary *)change NS_REQUIRES_SUPER;


#pragma mark - 鍏朵粬
/** 鎷夋嫿鐨勭櫨鍒嗘瘮(浜ょ粰瀛愮被閲嶅啓) */
@property (assign, nonatomic) CGFloat pullingPercent;
/** 鏍规嵁鎷栨嫿姣斾緥鑷姩鍒囨崲閫忔槑搴?*/
@property (assign, nonatomic, getter=isAutoChangeAlpha) BOOL autoChangeAlpha MJRefreshDeprecated("璇蜂娇鐢╝utomaticallyChangeAlpha灞炴€?);
/** 鏍规嵁鎷栨嫿姣斾緥鑷姩鍒囨崲閫忔槑搴?*/
@property (assign, nonatomic, getter=isAutomaticallyChangeAlpha) BOOL automaticallyChangeAlpha;
@end

@interface UILabel(MJRefresh)
+ (instancetype)label;
@end
// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com// 鐗堟潈灞炰簬鍘熶綔鑰?// http://code4app.com (cn) http://code4app.net (en)
// 鍙戝竷浠g爜浜庢渶涓撲笟鐨勬簮鐮佸垎浜綉绔? Code4App.com