-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75b6acf
commit c6adc9c
Showing
5 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-164 Bytes
(99%)
...codeproj/project.xcworkspace/xcuserdata/songwt.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// UIButton+WTImageCache.h | ||
// WTRequestCenter | ||
// | ||
// Created by songwt on 14-7-30. | ||
// Copyright (c) 2014年 song. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIButton (WTImageCache) | ||
|
||
- (void)setImageForState:(UIControlState)state | ||
withURL:(NSURL *)url; | ||
|
||
- (void)setImageForState:(UIControlState)state | ||
withURL:(NSURL *)url | ||
placeholderImage:(UIImage *)placeholderImage; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// UIButton+WTImageCache.m | ||
// WTRequestCenter | ||
// | ||
// Created by songwt on 14-7-30. | ||
// Copyright (c) 2014年 song. All rights reserved. | ||
// | ||
|
||
#import "UIButton+WTImageCache.h" | ||
#import "WTRequestCenter.h" | ||
@implementation UIButton (WTImageCache) | ||
|
||
- (void)setImageForState:(UIControlState)state | ||
withURL:(NSURL *)url | ||
{ | ||
[self setImageForState:state withURL:url placeholderImage:nil]; | ||
} | ||
- (void)setImageForState:(UIControlState)state | ||
withURL:(NSURL *)url | ||
placeholderImage:(UIImage *)placeholderImage | ||
{ | ||
[self setImage:placeholderImage forState:state]; | ||
[WTRequestCenter getImageWithURL:url completionHandler:^(UIImage *image) { | ||
[self setImage:image forState:state]; | ||
}]; | ||
} | ||
@end |