2016-06-01 20:53:08 +08:00
|
|
|
/*
|
|
|
|
* This file is part of the SDWebImage package.
|
|
|
|
* (c) Olivier Poitrey <rs@dailymotion.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
2012-03-15 05:05:03 +08:00
|
|
|
|
|
|
|
#import "MKAnnotationView+WebCache.h"
|
2016-06-13 04:23:53 +08:00
|
|
|
|
|
|
|
#if SD_UIKIT || SD_MAC
|
|
|
|
|
2012-03-15 05:05:03 +08:00
|
|
|
@implementation MKAnnotationView (WebCache)
|
|
|
|
|
2016-06-03 22:25:21 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url {
|
2014-06-20 02:54:25 +08:00
|
|
|
[self sd_setImageWithURL:url placeholderImage:nil options:0 completed:nil];
|
2012-03-15 05:05:03 +08:00
|
|
|
}
|
|
|
|
|
2016-06-03 22:25:21 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder {
|
2014-06-20 02:54:25 +08:00
|
|
|
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 completed:nil];
|
2012-03-15 05:05:03 +08:00
|
|
|
}
|
|
|
|
|
2016-06-03 22:25:21 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options {
|
2018-06-23 15:04:12 +08:00
|
|
|
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context {
|
|
|
|
[self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil];
|
2012-03-15 05:05:03 +08:00
|
|
|
}
|
|
|
|
|
2016-06-07 17:42:26 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock {
|
2014-06-20 02:54:25 +08:00
|
|
|
[self sd_setImageWithURL:url placeholderImage:nil options:0 completed:completedBlock];
|
2012-03-15 05:05:03 +08:00
|
|
|
}
|
|
|
|
|
2016-06-07 17:42:26 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock {
|
2014-06-20 02:54:25 +08:00
|
|
|
[self sd_setImageWithURL:url placeholderImage:placeholder options:0 completed:completedBlock];
|
2012-03-15 05:05:03 +08:00
|
|
|
}
|
|
|
|
|
2018-04-02 03:24:23 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock {
|
|
|
|
[self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock];
|
|
|
|
}
|
|
|
|
|
2018-05-17 14:04:57 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock {
|
2018-04-02 03:24:23 +08:00
|
|
|
[self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock];
|
|
|
|
}
|
|
|
|
|
2016-06-03 22:25:21 +08:00
|
|
|
- (void)sd_setImageWithURL:(nullable NSURL *)url
|
|
|
|
placeholderImage:(nullable UIImage *)placeholder
|
|
|
|
options:(SDWebImageOptions)options
|
2018-04-02 03:24:23 +08:00
|
|
|
context:(nullable SDWebImageContext *)context
|
2018-05-17 14:04:57 +08:00
|
|
|
progress:(nullable SDImageLoaderProgressBlock)progressBlock
|
2016-06-07 17:42:26 +08:00
|
|
|
completed:(nullable SDExternalCompletionBlock)completedBlock {
|
2020-02-27 11:20:52 +08:00
|
|
|
__weak typeof(self) wself = self;
|
2016-09-26 00:44:52 +08:00
|
|
|
[self sd_internalSetImageWithURL:url
|
|
|
|
placeholderImage:placeholder
|
|
|
|
options:options
|
2018-04-02 03:24:23 +08:00
|
|
|
context:context
|
2018-08-16 11:32:12 +08:00
|
|
|
setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
2020-02-27 11:20:52 +08:00
|
|
|
wself.image = image;
|
2016-09-26 00:44:52 +08:00
|
|
|
}
|
2018-04-02 03:24:23 +08:00
|
|
|
progress:progressBlock
|
|
|
|
completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
|
|
|
if (completedBlock) {
|
|
|
|
completedBlock(image, error, cacheType, imageURL);
|
|
|
|
}
|
|
|
|
}];
|
2012-03-15 05:05:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
2016-06-13 04:23:53 +08:00
|
|
|
|
|
|
|
#endif
|