Permalink
Browse files

reformat code (appcode)

  • Loading branch information...
1 parent c00c2e0 commit 6dc02bd8f7c0b1b9dc6b0ef38556095babcc03a2 @akhenakh akhenakh committed Jan 7, 2014
@@ -13,53 +13,42 @@
@implementation MKAnnotationView (WebCache)
-- (void)setImageWithURL:(NSURL *)url
-{
+- (void)setImageWithURL:(NSURL *)url {
[self setImageWithURL:url placeholderImage:nil options:0 completed:nil];
}
-- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder
-{
+- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder {
[self setImageWithURL:url placeholderImage:placeholder options:0 completed:nil];
}
-- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options
-{
+- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options {
[self setImageWithURL:url placeholderImage:placeholder options:options completed:nil];
}
-- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock
-{
+- (void)setImageWithURL:(NSURL *)url completed:(SDWebImageCompletedBlock)completedBlock {
[self setImageWithURL:url placeholderImage:nil options:0 completed:completedBlock];
}
-- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock
-{
+- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder completed:(SDWebImageCompletedBlock)completedBlock {
[self setImageWithURL:url placeholderImage:placeholder options:0 completed:completedBlock];
}
-- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock
-{
+- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
[self cancelCurrentImageLoad];
self.image = placeholder;
-
- if (url)
- {
+
+ if (url) {
__weak MKAnnotationView *wself = self;
- id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
- {
+ id <SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) {
if (!wself) return;
- dispatch_main_sync_safe(^
- {
+ dispatch_main_sync_safe(^{
__strong MKAnnotationView *sself = wself;
if (!sself) return;
- if (image)
- {
+ if (image) {
sself.image = image;
}
- if (completedBlock && finished)
- {
+ if (completedBlock && finished) {
completedBlock(image, error, cacheType);
}
});
@@ -68,12 +57,10 @@ - (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholder opt
}
}
-- (void)cancelCurrentImageLoad
-{
+- (void)cancelCurrentImageLoad {
// Cancel in progress downloader from queue
- id<SDWebImageOperation> operation = objc_getAssociatedObject(self, &operationKey);
- if (operation)
- {
+ id <SDWebImageOperation> operation = objc_getAssociatedObject(self, &operationKey);
+ if (operation) {
[operation cancel];
objc_setAssociatedObject(self, &operationKey, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
@@ -9,20 +9,19 @@
#import <Foundation/Foundation.h>
#import "SDWebImageCompat.h"
-enum SDImageCacheType
-{
+enum SDImageCacheType {
/**
* The image wasn't available the SDWebImage caches, but was downloaded from the web.
*/
- SDImageCacheTypeNone = 0,
+ SDImageCacheTypeNone = 0,
/**
* The image was obtained from the disk cache.
*/
- SDImageCacheTypeDisk,
+ SDImageCacheTypeDisk,
/**
* The image was obtained from the memory cache.
*/
- SDImageCacheTypeMemory
+ SDImageCacheTypeMemory
};
typedef enum SDImageCacheType SDImageCacheType;
Oops, something went wrong. Retry.

0 comments on commit 6dc02bd

Please sign in to comment.