Skip to content

Commit 6d01e80

Browse files
committed
Added comments and coding style to previous pull request #771
1 parent 9b18145 commit 6d01e80

File tree

2 files changed

+33
-17
lines changed

2 files changed

+33
-17
lines changed

SDWebImage/UIView+WebCacheOperation.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
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+
*/
88

99
#import <UIKit/UIKit.h>
1010
#import "SDWebImageManager.h"
1111

1212
@interface UIView (WebCacheOperation)
1313

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;
1521

22+
/**
23+
* Cancel all operations for the current UIView and key
24+
*
25+
* @param key key for identifying the operations
26+
*/
1627
- (void)cancelImageLoadOperationWithKey:(NSString *)key;
1728

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+
*/
1834
- (void)removeImageLoadOperationWithKey:(NSString *)key;
1935

2036
@end

SDWebImage/UIView+WebCacheOperation.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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+
*/
88

99
#import "UIView+WebCacheOperation.h"
1010
#import "objc/runtime.h"
@@ -32,15 +32,15 @@ - (void)setImageLoadOperation:(id)operation forKey:(NSString *)key {
3232
- (void)cancelImageLoadOperationWithKey:(NSString *)key {
3333
// Cancel in progress downloader from queue
3434
NSMutableDictionary *operationDictionary = [self operationDictionary];
35-
id operations = [operationDictionary objectForKey:key];
35+
id operations = [operationDictionary objectForKey:key];
3636
if (operations) {
3737
if ([operations isKindOfClass:[NSArray class]]) {
3838
for (id <SDWebImageOperation> operation in operations) {
3939
if (operation) {
4040
[operation cancel];
4141
}
4242
}
43-
} else {
43+
} else if ([operations conformsToProtocol:@protocol(SDWebImageOperation)]){
4444
[(id<SDWebImageOperation>) operations cancel];
4545
}
4646
[operationDictionary removeObjectForKey:key];

0 commit comments

Comments
 (0)