Remove Dailymotion paternity and move to joined paternity with Fraggle behind th…
…e Simple Design (SD) team name
Showing
8 changed files
with
44 additions
and
44 deletions
1 | -Copyright (c) 2009 Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 1 | +Copyright (c) 2009 Olivier Poitrey <rs@dailymotion.com> |
2 | 2 | ||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | of this software and associated documentation files (the "Software"), to deal | 4 | of this software and associated documentation files (the "Software"), to deal |
@@ -58,25 +58,25 @@ it, et voila! | @@ -58,25 +58,25 @@ it, et voila! | ||
58 | How To Use It | 58 | How To Use It |
59 | ------------- | 59 | ------------- |
60 | 60 | ||
61 | -### DMWebImageView as UIImageWeb Drop-In Replacement | 61 | +### SDWebImageView as UIImageWeb Drop-In Replacement |
62 | 62 | ||
63 | Most common use is in conjunction with an UITableView: | 63 | Most common use is in conjunction with an UITableView: |
64 | 64 | ||
65 | - Place an UIImageView as a subview of your UITableViewCell in Interface Builder | 65 | - Place an UIImageView as a subview of your UITableViewCell in Interface Builder |
66 | -- Set its class to DMImageView in the identity panel. | 66 | +- Set its class to SDImageView in the identity panel. |
67 | - Optionally set an image from your bundle to this UIImageView, it will be used as a placeholder | 67 | - Optionally set an image from your bundle to this UIImageView, it will be used as a placeholder |
68 | image waiting for the real image to be downloaded. | 68 | image waiting for the real image to be downloaded. |
69 | - In your tableView:cellForRowAtIndexPath: UITableViewDataSource method, invoke the setImageWithURL: | 69 | - In your tableView:cellForRowAtIndexPath: UITableViewDataSource method, invoke the setImageWithURL: |
70 | - method of the DMWebImage view with the URL of the image to download | 70 | + method of the SDWebImage view with the URL of the image to download |
71 | 71 | ||
72 | Your done, everything will be handled for you, from parallel downloads to caching management. | 72 | Your done, everything will be handled for you, from parallel downloads to caching management. |
73 | 73 | ||
74 | ### Asynchronous Image Downloader | 74 | ### Asynchronous Image Downloader |
75 | 75 | ||
76 | It is possible to use the NSOperation based image downloader independently. Just create an instance | 76 | It is possible to use the NSOperation based image downloader independently. Just create an instance |
77 | -of DMWebImageDownloader using its convenience constructor downloaderWithURL:target:action:. | 77 | +of SDWebImageDownloader using its convenience constructor downloaderWithURL:target:action:. |
78 | 78 | ||
79 | - downloader = [DMWebImageDownloader downloaderWithURL:url | 79 | + downloader = [SDWebImageDownloader downloaderWithURL:url |
80 | target:self | 80 | target:self |
81 | action:@selector(downloadFinishedWithImage:)]; | 81 | action:@selector(downloadFinishedWithImage:)]; |
82 | 82 | ||
@@ -85,11 +85,11 @@ soon as the download of image will be completed (prepare not to be called from t | @@ -85,11 +85,11 @@ soon as the download of image will be completed (prepare not to be called from t | ||
85 | 85 | ||
86 | ### Asynchronous Image Caching | 86 | ### Asynchronous Image Caching |
87 | 87 | ||
88 | -It is also possible to use the NSOperation based image cache store independently. DMImageCache | 88 | +It is also possible to use the NSOperation based image cache store independently. SDImageCache |
89 | maintains a memory cache and an optional disk cache. Disk cache write operations are performed | 89 | maintains a memory cache and an optional disk cache. Disk cache write operations are performed |
90 | asynchronous so it doesn't add unnecessary latency to the UI. | 90 | asynchronous so it doesn't add unnecessary latency to the UI. |
91 | 91 | ||
92 | -The DMImageCache class provides a singleton instance for convenience but you can create your own | 92 | +The SDImageCache class provides a singleton instance for convenience but you can create your own |
93 | instance if you want to create separated cache namespaces. | 93 | instance if you want to create separated cache namespaces. |
94 | 94 | ||
95 | To lookup the cache, you use the imageForKey: method. If the method returns nil, it means the cache | 95 | To lookup the cache, you use the imageForKey: method. If the method returns nil, it means the cache |
@@ -97,15 +97,15 @@ doesn't currently own the image. You are thus responsible of generating and cach | @@ -97,15 +97,15 @@ doesn't currently own the image. You are thus responsible of generating and cach | ||
97 | key is an application unique identifier for the image to cache. It is generally the absolute URL of | 97 | key is an application unique identifier for the image to cache. It is generally the absolute URL of |
98 | the image. | 98 | the image. |
99 | 99 | ||
100 | - UIImage *myCachedImage = [[DMImageCache sharedImageCache] imageFromKey:myCacheKey]; | 100 | + UIImage *myCachedImage = [[SDImageCache sharedImageCache] imageFromKey:myCacheKey]; |
101 | 101 | ||
102 | -By default DMImageCache will lookup the disk cache if an image can't be found in the memory cache. | 102 | +By default SDImageCache will lookup the disk cache if an image can't be found in the memory cache. |
103 | You can prevent this from happening by calling the alternative method imageFromKey:fromDisk: with a | 103 | You can prevent this from happening by calling the alternative method imageFromKey:fromDisk: with a |
104 | negative second argument. | 104 | negative second argument. |
105 | 105 | ||
106 | To store an image into the cache, you use the storeImage:forKey: method: | 106 | To store an image into the cache, you use the storeImage:forKey: method: |
107 | 107 | ||
108 | - [[DMImageCache sharedImageCache] storeImage:myImage forKey:myCacheKey]; | 108 | + [[SDImageCache sharedImageCache] storeImage:myImage forKey:myCacheKey]; |
109 | 109 | ||
110 | By default, the image will be stored in memory cache as well as on disk cache (asynchronously). If | 110 | By default, the image will be stored in memory cache as well as on disk cache (asynchronously). If |
111 | you want only the memory cache, use the alternative method storeImage:forKey:toDisk: with a negative | 111 | you want only the memory cache, use the alternative method storeImage:forKey:toDisk: with a negative |
1 | /* | 1 | /* |
2 | - * This file is part of the DMWebImage package. | ||
3 | - * (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 2 | + * This file is part of the SDWebImage package. |
3 | + * (c) Olivier Poitrey <rs@dailymotion.com> | ||
4 | * | 4 | * |
5 | * For the full copyright and license information, please view the LICENSE | 5 | * For the full copyright and license information, please view the LICENSE |
6 | * file that was distributed with this source code. | 6 | * file that was distributed with this source code. |
@@ -8,14 +8,14 @@ | @@ -8,14 +8,14 @@ | ||
8 | 8 | ||
9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
10 | 10 | ||
11 | -@interface DMImageCache : NSObject | 11 | +@interface SDImageCache : NSObject |
12 | { | 12 | { |
13 | NSMutableDictionary *memCache; | 13 | NSMutableDictionary *memCache; |
14 | NSString *diskCachePath; | 14 | NSString *diskCachePath; |
15 | NSOperationQueue *cacheInQueue; | 15 | NSOperationQueue *cacheInQueue; |
16 | } | 16 | } |
17 | 17 | ||
18 | -+ (DMImageCache *)sharedImageCache; | 18 | ++ (SDImageCache *)sharedImageCache; |
19 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key; | 19 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key; |
20 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk; | 20 | - (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk; |
21 | - (UIImage *)imageFromKey:(NSString *)key; | 21 | - (UIImage *)imageFromKey:(NSString *)key; |
1 | /* | 1 | /* |
2 | - * This file is part of the DMWebImage package. | ||
3 | - * (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 2 | + * This file is part of the SDWebImage package. |
3 | + * (c) Olivier Poitrey <rs@dailymotion.com> | ||
4 | * | 4 | * |
5 | * For the full copyright and license information, please view the LICENSE | 5 | * For the full copyright and license information, please view the LICENSE |
6 | * file that was distributed with this source code. | 6 | * file that was distributed with this source code. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | -#import "DMImageCache.h" | 9 | +#import "SDImageCache.h" |
10 | #import <CommonCrypto/CommonDigest.h> | 10 | #import <CommonCrypto/CommonDigest.h> |
11 | 11 | ||
12 | static NSInteger cacheMaxCacheAge = 60*60*24*7; // 1 week | 12 | static NSInteger cacheMaxCacheAge = 60*60*24*7; // 1 week |
13 | 13 | ||
14 | -static DMImageCache *instance; | 14 | +static SDImageCache *instance; |
15 | 15 | ||
16 | -@implementation DMImageCache | 16 | +@implementation SDImageCache |
17 | 17 | ||
18 | #pragma mark NSObject | 18 | #pragma mark NSObject |
19 | 19 | ||
@@ -81,11 +81,11 @@ static DMImageCache *instance; | @@ -81,11 +81,11 @@ static DMImageCache *instance; | ||
81 | 81 | ||
82 | #pragma mark ImageCache (class methods) | 82 | #pragma mark ImageCache (class methods) |
83 | 83 | ||
84 | -+ (DMImageCache *)sharedImageCache | 84 | ++ (SDImageCache *)sharedImageCache |
85 | { | 85 | { |
86 | if (instance == nil) | 86 | if (instance == nil) |
87 | { | 87 | { |
88 | - instance = [[DMImageCache alloc] init]; | 88 | + instance = [[SDImageCache alloc] init]; |
89 | } | 89 | } |
90 | 90 | ||
91 | return instance; | 91 | return instance; |
1 | /* | 1 | /* |
2 | - * This file is part of the DMWebImage package. | ||
3 | - * (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 2 | + * This file is part of the SDWebImage package. |
3 | + * (c) Olivier Poitrey <rs@dailymotion.com> | ||
4 | * | 4 | * |
5 | * For the full copyright and license information, please view the LICENSE | 5 | * For the full copyright and license information, please view the LICENSE |
6 | * file that was distributed with this source code. | 6 | * file that was distributed with this source code. |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | 8 | ||
9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
10 | 10 | ||
11 | -@interface DMWebImageDownloader : NSOperation | 11 | +@interface SDWebImageDownloader : NSOperation |
12 | { | 12 | { |
13 | NSURL *url; | 13 | NSURL *url; |
14 | id target; | 14 | id target; |
1 | /* | 1 | /* |
2 | - * This file is part of the DMWebImage package. | ||
3 | - * (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 2 | + * This file is part of the SDWebImage package. |
3 | + * (c) Olivier Poitrey <rs@dailymotion.com> | ||
4 | * | 4 | * |
5 | * For the full copyright and license information, please view the LICENSE | 5 | * For the full copyright and license information, please view the LICENSE |
6 | * file that was distributed with this source code. | 6 | * file that was distributed with this source code. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | -#import "DMWebImageDownloader.h" | 9 | +#import "SDWebImageDownloader.h" |
10 | 10 | ||
11 | static NSOperationQueue *downloadQueue; | 11 | static NSOperationQueue *downloadQueue; |
12 | 12 | ||
13 | -@implementation DMWebImageDownloader | 13 | +@implementation SDWebImageDownloader |
14 | 14 | ||
15 | @synthesize url, target, action; | 15 | @synthesize url, target, action; |
16 | 16 | ||
@@ -22,7 +22,7 @@ static NSOperationQueue *downloadQueue; | @@ -22,7 +22,7 @@ static NSOperationQueue *downloadQueue; | ||
22 | 22 | ||
23 | + (id)downloaderWithURL:(NSURL *)url target:(id)target action:(SEL)action | 23 | + (id)downloaderWithURL:(NSURL *)url target:(id)target action:(SEL)action |
24 | { | 24 | { |
25 | - DMWebImageDownloader *downloader = [[[DMWebImageDownloader alloc] init] autorelease]; | 25 | + SDWebImageDownloader *downloader = [[[SDWebImageDownloader alloc] init] autorelease]; |
26 | downloader.url = url; | 26 | downloader.url = url; |
27 | downloader.target = target; | 27 | downloader.target = target; |
28 | downloader.action = action; | 28 | downloader.action = action; |
1 | /* | 1 | /* |
2 | - * This file is part of the DMWebImage package. | ||
3 | - * (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 2 | + * This file is part of the SDWebImage package. |
3 | + * (c) Olivier Poitrey <rs@dailymotion.com> | ||
4 | * | 4 | * |
5 | * For the full copyright and license information, please view the LICENSE | 5 | * For the full copyright and license information, please view the LICENSE |
6 | * file that was distributed with this source code. | 6 | * file that was distributed with this source code. |
@@ -8,12 +8,12 @@ | @@ -8,12 +8,12 @@ | ||
8 | 8 | ||
9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
10 | 10 | ||
11 | -@class DMWebImageDownloader; | 11 | +@class SDWebImageDownloader; |
12 | 12 | ||
13 | -@interface DMWebImageView : UIImageView | 13 | +@interface SDWebImageView : UIImageView |
14 | { | 14 | { |
15 | UIImage *placeHolderImage; | 15 | UIImage *placeHolderImage; |
16 | - DMWebImageDownloader *downloader; | 16 | + SDWebImageDownloader *downloader; |
17 | } | 17 | } |
18 | 18 | ||
19 | - (void)setImageWithURL:(NSURL *)url; | 19 | - (void)setImageWithURL:(NSURL *)url; |
1 | /* | 1 | /* |
2 | - * This file is part of the DMWebImage package. | ||
3 | - * (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com> | 2 | + * This file is part of the SDWebImage package. |
3 | + * (c) Olivier Poitrey <rs@dailymotion.com> | ||
4 | * | 4 | * |
5 | * For the full copyright and license information, please view the LICENSE | 5 | * For the full copyright and license information, please view the LICENSE |
6 | * file that was distributed with this source code. | 6 | * file that was distributed with this source code. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | -#import "DMWebImageView.h" | ||
10 | -#import "DMImageCache.h" | ||
11 | -#import "DMWebImageDownloader.h" | 9 | +#import "SDWebImageView.h" |
10 | +#import "SDImageCache.h" | ||
11 | +#import "SDWebImageDownloader.h" | ||
12 | 12 | ||
13 | -@implementation DMWebImageView | 13 | +@implementation SDWebImageView |
14 | 14 | ||
15 | - (void)dealloc | 15 | - (void)dealloc |
16 | { | 16 | { |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | self.image = placeHolderImage; | 41 | self.image = placeHolderImage; |
42 | } | 42 | } |
43 | 43 | ||
44 | - UIImage *cachedImage = [[DMImageCache sharedImageCache] imageFromKey:[url absoluteString]]; | 44 | + UIImage *cachedImage = [[SDImageCache sharedImageCache] imageFromKey:[url absoluteString]]; |
45 | 45 | ||
46 | if (cachedImage) | 46 | if (cachedImage) |
47 | { | 47 | { |
@@ -49,7 +49,7 @@ | @@ -49,7 +49,7 @@ | ||
49 | } | 49 | } |
50 | else | 50 | else |
51 | { | 51 | { |
52 | - downloader = [[DMWebImageDownloader downloaderWithURL:url target:self action:@selector(downloadFinishedWithImage:)] retain]; | 52 | + downloader = [[SDWebImageDownloader downloaderWithURL:url target:self action:@selector(downloadFinishedWithImage:)] retain]; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | self.image = anImage; | 59 | self.image = anImage; |
60 | 60 | ||
61 | // Store the image in the cache | 61 | // Store the image in the cache |
62 | - [[DMImageCache sharedImageCache] storeImage:anImage forKey:[downloader.url absoluteString]]; | 62 | + [[SDImageCache sharedImageCache] storeImage:anImage forKey:[downloader.url absoluteString]]; |
63 | 63 | ||
64 | // Free the downloader | 64 | // Free the downloader |
65 | [downloader release]; | 65 | [downloader release]; |
-
Please register or login to post a comment