Whitespace formatting
This commit is contained in:
parent
cd8cee4ac8
commit
d9da9e5c1a
1 changed files with 15 additions and 15 deletions
|
|
@ -1,17 +1,17 @@
|
|||
// UIImageView+AFNetworking.m
|
||||
//
|
||||
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
|
@ -63,7 +63,7 @@ static char kAFImageRequestOperationObjectKey;
|
|||
_af_imageRequestOperationQueue = [[NSOperationQueue alloc] init];
|
||||
[_af_imageRequestOperationQueue setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount];
|
||||
});
|
||||
|
||||
|
||||
return _af_imageRequestOperationQueue;
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ static char kAFImageRequestOperationObjectKey;
|
|||
dispatch_once(&oncePredicate, ^{
|
||||
_af_imageCache = [[AFImageCache alloc] init];
|
||||
});
|
||||
|
||||
|
||||
return _af_imageCache;
|
||||
}
|
||||
|
||||
|
|
@ -83,34 +83,34 @@ static char kAFImageRequestOperationObjectKey;
|
|||
[self setImageWithURL:url placeholderImage:nil];
|
||||
}
|
||||
|
||||
- (void)setImageWithURL:(NSURL *)url
|
||||
- (void)setImageWithURL:(NSURL *)url
|
||||
placeholderImage:(UIImage *)placeholderImage
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
[request setHTTPShouldHandleCookies:NO];
|
||||
[request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
|
||||
|
||||
|
||||
[self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
|
||||
}
|
||||
|
||||
- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
|
||||
placeholderImage:(UIImage *)placeholderImage
|
||||
- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
|
||||
placeholderImage:(UIImage *)placeholderImage
|
||||
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
|
||||
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure
|
||||
{
|
||||
[self cancelImageRequestOperation];
|
||||
|
||||
|
||||
UIImage *cachedImage = [[[self class] af_sharedImageCache] cachedImageForRequest:urlRequest];
|
||||
if (cachedImage) {
|
||||
self.image = cachedImage;
|
||||
self.af_imageRequestOperation = nil;
|
||||
|
||||
|
||||
if (success) {
|
||||
success(nil, nil, cachedImage);
|
||||
}
|
||||
} else {
|
||||
self.image = placeholderImage;
|
||||
|
||||
|
||||
AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest];
|
||||
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
|
||||
if ([[urlRequest URL] isEqual:[[self.af_imageRequestOperation request] URL]]) {
|
||||
|
|
@ -121,7 +121,7 @@ static char kAFImageRequestOperationObjectKey;
|
|||
}
|
||||
|
||||
if (self.af_imageRequestOperation == operation) {
|
||||
self.af_imageRequestOperation = nil;
|
||||
self.af_imageRequestOperation = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ static char kAFImageRequestOperationObjectKey;
|
|||
}
|
||||
|
||||
if (self.af_imageRequestOperation == operation) {
|
||||
self.af_imageRequestOperation = nil;
|
||||
self.af_imageRequestOperation = nil;
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
|
@ -167,7 +167,7 @@ static inline NSString * AFImageCacheKeyFromURLRequest(NSURLRequest *request) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return [self objectForKey:AFImageCacheKeyFromURLRequest(request)];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue