File tree Expand file tree Collapse file tree 2 files changed +33
-17
lines changed Expand file tree Collapse file tree 2 files changed +33
-17
lines changed Original file line number Diff line number Diff line change 1
- //
2
- // UIView+WebCacheOperation.h
3
- // SDWebImage
4
- //
5
- // Created by Whirlwind on 14-5-22.
6
- // Copyright (c) 2014年 Dailymotion. All rights reserved .
7
- / /
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code .
7
+ * /
8
8
9
9
#import < UIKit/UIKit.h>
10
10
#import " SDWebImageManager.h"
11
11
12
12
@interface UIView (WebCacheOperation)
13
13
14
- - (void )setImageLoadOperation : (id )operation forKey : (NSString *)Key ;
14
+ /* *
15
+ * Set the image load operation (storage in a UIView based dictionary)
16
+ *
17
+ * @param operation the operation
18
+ * @param key key for storing the operation
19
+ */
20
+ - (void )setImageLoadOperation : (id )operation forKey : (NSString *)key ;
15
21
22
+ /* *
23
+ * Cancel all operations for the current UIView and key
24
+ *
25
+ * @param key key for identifying the operations
26
+ */
16
27
- (void )cancelImageLoadOperationWithKey : (NSString *)key ;
17
28
29
+ /* *
30
+ * Just remove the operations corresponding to the current UIView and key without cancelling them
31
+ *
32
+ * @param key key for identifying the operations
33
+ */
18
34
- (void )removeImageLoadOperationWithKey : (NSString *)key ;
19
35
20
36
@end
Original file line number Diff line number Diff line change 1
- //
2
- // UIView+WebCacheOperation.m
3
- // SDWebImage
4
- //
5
- // Created by Whirlwind on 14-5-22.
6
- // Copyright (c) 2014年 Dailymotion. All rights reserved .
7
- / /
1
+ /*
2
+ * This file is part of the SDWebImage package.
3
+ * (c) Olivier Poitrey <rs@dailymotion.com>
4
+ *
5
+ * For the full copyright and license information, please view the LICENSE
6
+ * file that was distributed with this source code .
7
+ * /
8
8
9
9
#import " UIView+WebCacheOperation.h"
10
10
#import " objc/runtime.h"
@@ -32,15 +32,15 @@ - (void)setImageLoadOperation:(id)operation forKey:(NSString *)key {
32
32
- (void )cancelImageLoadOperationWithKey : (NSString *)key {
33
33
// Cancel in progress downloader from queue
34
34
NSMutableDictionary *operationDictionary = [self operationDictionary ];
35
- id operations = [operationDictionary objectForKey: key];
35
+ id operations = [operationDictionary objectForKey: key];
36
36
if (operations) {
37
37
if ([operations isKindOfClass: [NSArray class ]]) {
38
38
for (id <SDWebImageOperation> operation in operations) {
39
39
if (operation) {
40
40
[operation cancel ];
41
41
}
42
42
}
43
- } else {
43
+ } else if ([operations conformsToProtocol: @protocol (SDWebImageOperation)]) {
44
44
[(id <SDWebImageOperation>) operations cancel ];
45
45
}
46
46
[operationDictionary removeObjectForKey: key];
You can’t perform that action at this time.
0 commit comments