//
//  UIImageView+webImage.h
//  LampRibbon
//
//  Created by coderYK on 2017/8/9.
//  Copyright © 2017年 RD-iOS. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <UIImageView+WebCache.h>

/**
 基于SDWebImage的二次封装
 */
@interface UIImageView (webImage)

typedef void (^rds_DownloadSuccessBlock) (SDImageCacheType cacheType, UIImage *image);
typedef void (^rds_DownloadFailureBlock) (NSError *error);
typedef void (^rds_DownloadProgressBlock) (CGFloat progress);


/**
 下载并缓存图片

 @param url 图片的资源路径
 @param placeHoler 未下载成功时的占位图片
 */
- (void)rds_downloadImage:(NSString *)url
               placeHoler:(UIImage *)placeHoler;


/**
 下载并缓存图片和下载进度

 @param url 图片的资源路径
 @param placeHoler 未下载成功时的占位图片
 @param success 图片下载成功的回调
 @param failure 图片下载失败的回调
 @param progress 图片下载进度的回调
 */
- (void)rds_downloadImage:(NSString *)url
               placeHoler:(UIImage *)placeHoler
                  success:(rds_DownloadSuccessBlock)success
                  failure:(rds_DownloadFailureBlock)failure
                 received:(rds_DownloadProgressBlock)progress;

@end
