|
@@ -9,16 +9,10 @@ |
|
@@ -9,16 +9,10 @@ |
9
|
#import "UIButton+WebCache.h"
|
9
|
#import "UIButton+WebCache.h"
|
10
|
#import "objc/runtime.h"
|
10
|
#import "objc/runtime.h"
|
11
|
|
11
|
|
12
|
-static char imageURLKey;
|
|
|
13
|
static char operationKey;
|
12
|
static char operationKey;
|
14
|
|
13
|
|
15
|
@implementation UIButton (WebCache)
|
14
|
@implementation UIButton (WebCache)
|
16
|
|
15
|
|
17
|
-- (NSURL *)currentImageURL;
|
|
|
18
|
-{
|
|
|
19
|
- return objc_getAssociatedObject(self, &imageURLKey);
|
|
|
20
|
-}
|
|
|
21
|
-
|
|
|
22
|
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state
|
16
|
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state
|
23
|
{
|
17
|
{
|
24
|
[self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];
|
18
|
[self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];
|
|
@@ -43,7 +37,6 @@ static char operationKey; |
|
@@ -43,7 +37,6 @@ static char operationKey; |
43
|
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
|
37
|
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
|
44
|
[self cancelCurrentImageLoad];
|
38
|
[self cancelCurrentImageLoad];
|
45
|
|
39
|
|
46
|
- objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
|
47
|
[self setImage:placeholder forState:state];
|
40
|
[self setImage:placeholder forState:state];
|
48
|
|
41
|
|
49
|
if (url) {
|
42
|
if (url) {
|