Refactoring image request operation
This commit is contained in:
parent
3e27e189ee
commit
b7724922c4
2 changed files with 6 additions and 7 deletions
|
|
@ -81,7 +81,6 @@ static dispatch_queue_t image_request_operation_processing_queue() {
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
||||||
|
|
||||||
success(operation.request, operation.response, image);
|
success(operation.request, operation.response, image);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#import "AFImageCache.h"
|
#import "AFImageCache.h"
|
||||||
|
|
||||||
static NSString * const kAFImageRequestOperationObjectKey = @"_af_imageRequestOperation";
|
static char kAFImageRequestOperationObjectKey;
|
||||||
|
|
||||||
@interface UIImageView (_AFNetworking)
|
@interface UIImageView (_AFNetworking)
|
||||||
@property (readwrite, nonatomic, retain, setter = af_setImageRequestOperation:) AFImageRequestOperation *af_imageRequestOperation;
|
@property (readwrite, nonatomic, retain, setter = af_setImageRequestOperation:) AFImageRequestOperation *af_imageRequestOperation;
|
||||||
|
|
@ -42,11 +42,11 @@ static NSString * const kAFImageRequestOperationObjectKey = @"_af_imageRequestOp
|
||||||
@implementation UIImageView (AFNetworking)
|
@implementation UIImageView (AFNetworking)
|
||||||
|
|
||||||
- (AFHTTPRequestOperation *)af_imageRequestOperation {
|
- (AFHTTPRequestOperation *)af_imageRequestOperation {
|
||||||
return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, kAFImageRequestOperationObjectKey);
|
return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, &kAFImageRequestOperationObjectKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)af_setImageRequestOperation:(AFImageRequestOperation *)imageRequestOperation {
|
- (void)af_setImageRequestOperation:(AFImageRequestOperation *)imageRequestOperation {
|
||||||
objc_setAssociatedObject(self, kAFImageRequestOperationObjectKey, imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
objc_setAssociatedObject(self, &kAFImageRequestOperationObjectKey, imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSOperationQueue *)af_sharedImageRequestOperationQueue {
|
+ (NSOperationQueue *)af_sharedImageRequestOperationQueue {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue