Scratch that, this won't work on UIButton
This commit is contained in:
parent
825207d1d0
commit
67ed774c0c
|
@ -14,14 +14,6 @@
|
||||||
*/
|
*/
|
||||||
@interface UIButton (WebCache)
|
@interface UIButton (WebCache)
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current image URL.
|
|
||||||
*
|
|
||||||
* Note that because of the limitations of categories this property can get out of sync
|
|
||||||
* if you use setImage: directly.
|
|
||||||
*/
|
|
||||||
- (NSURL *)currentImageURL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the imageView `image` with an `url`.
|
* Set the imageView `image` with an `url`.
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,16 +9,10 @@
|
||||||
#import "UIButton+WebCache.h"
|
#import "UIButton+WebCache.h"
|
||||||
#import "objc/runtime.h"
|
#import "objc/runtime.h"
|
||||||
|
|
||||||
static char imageURLKey;
|
|
||||||
static char operationKey;
|
static char operationKey;
|
||||||
|
|
||||||
@implementation UIButton (WebCache)
|
@implementation UIButton (WebCache)
|
||||||
|
|
||||||
- (NSURL *)currentImageURL;
|
|
||||||
{
|
|
||||||
return objc_getAssociatedObject(self, &imageURLKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state
|
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state
|
||||||
{
|
{
|
||||||
[self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];
|
[self setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil];
|
||||||
|
@ -43,7 +37,6 @@ static char operationKey;
|
||||||
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
|
- (void)setImageWithURL:(NSURL *)url forState:(UIControlState)state placeholderImage:(UIImage *)placeholder options:(SDWebImageOptions)options completed:(SDWebImageCompletedBlock)completedBlock {
|
||||||
[self cancelCurrentImageLoad];
|
[self cancelCurrentImageLoad];
|
||||||
|
|
||||||
objc_setAssociatedObject(self, &imageURLKey, url, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
|
||||||
[self setImage:placeholder forState:state];
|
[self setImage:placeholder forState:state];
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
|
|
Loading…
Reference in New Issue