Remove Dailymotion paternity and move to joined paternity with Fraggle behind the Simple Design (SD) team name

This commit is contained in:
Olivier Poitrey 2009-09-21 19:34:32 +02:00
parent 8370d5dfaf
commit a7734af511
8 changed files with 44 additions and 44 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2009 Dailymotion - Olivier Poitrey <rs@dailymotion.com>
Copyright (c) 2009 Olivier Poitrey <rs@dailymotion.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -58,25 +58,25 @@ it, et voila!
How To Use It
-------------
### DMWebImageView as UIImageWeb Drop-In Replacement
### SDWebImageView as UIImageWeb Drop-In Replacement
Most common use is in conjunction with an UITableView:
- Place an UIImageView as a subview of your UITableViewCell in Interface Builder
- Set its class to DMImageView in the identity panel.
- Set its class to SDImageView in the identity panel.
- Optionally set an image from your bundle to this UIImageView, it will be used as a placeholder
image waiting for the real image to be downloaded.
- In your tableView:cellForRowAtIndexPath: UITableViewDataSource method, invoke the setImageWithURL:
method of the DMWebImage view with the URL of the image to download
method of the SDWebImage view with the URL of the image to download
Your done, everything will be handled for you, from parallel downloads to caching management.
### Asynchronous Image Downloader
It is possible to use the NSOperation based image downloader independently. Just create an instance
of DMWebImageDownloader using its convenience constructor downloaderWithURL:target:action:.
of SDWebImageDownloader using its convenience constructor downloaderWithURL:target:action:.
downloader = [DMWebImageDownloader downloaderWithURL:url
downloader = [SDWebImageDownloader downloaderWithURL:url
target:self
action:@selector(downloadFinishedWithImage:)];
@ -85,11 +85,11 @@ soon as the download of image will be completed (prepare not to be called from t
### Asynchronous Image Caching
It is also possible to use the NSOperation based image cache store independently. DMImageCache
It is also possible to use the NSOperation based image cache store independently. SDImageCache
maintains a memory cache and an optional disk cache. Disk cache write operations are performed
asynchronous so it doesn't add unnecessary latency to the UI.
The DMImageCache class provides a singleton instance for convenience but you can create your own
The SDImageCache class provides a singleton instance for convenience but you can create your own
instance if you want to create separated cache namespaces.
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
key is an application unique identifier for the image to cache. It is generally the absolute URL of
the image.
UIImage *myCachedImage = [[DMImageCache sharedImageCache] imageFromKey:myCacheKey];
UIImage *myCachedImage = [[SDImageCache sharedImageCache] imageFromKey:myCacheKey];
By default DMImageCache will lookup the disk cache if an image can't be found in the memory cache.
By default SDImageCache will lookup the disk cache if an image can't be found in the memory cache.
You can prevent this from happening by calling the alternative method imageFromKey:fromDisk: with a
negative second argument.
To store an image into the cache, you use the storeImage:forKey: method:
[[DMImageCache sharedImageCache] storeImage:myImage forKey:myCacheKey];
[[SDImageCache sharedImageCache] storeImage:myImage forKey:myCacheKey];
By default, the image will be stored in memory cache as well as on disk cache (asynchronously). If
you want only the memory cache, use the alternative method storeImage:forKey:toDisk: with a negative

View File

@ -1,6 +1,6 @@
/*
* This file is part of the DMWebImage package.
* (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com>
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@ -8,14 +8,14 @@
#import <Foundation/Foundation.h>
@interface DMImageCache : NSObject
@interface SDImageCache : NSObject
{
NSMutableDictionary *memCache;
NSString *diskCachePath;
NSOperationQueue *cacheInQueue;
}
+ (DMImageCache *)sharedImageCache;
+ (SDImageCache *)sharedImageCache;
- (void)storeImage:(UIImage *)image forKey:(NSString *)key;
- (void)storeImage:(UIImage *)image forKey:(NSString *)key toDisk:(BOOL)toDisk;
- (UIImage *)imageFromKey:(NSString *)key;

View File

@ -1,19 +1,19 @@
/*
* This file is part of the DMWebImage package.
* (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com>
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "DMImageCache.h"
#import "SDImageCache.h"
#import <CommonCrypto/CommonDigest.h>
static NSInteger cacheMaxCacheAge = 60*60*24*7; // 1 week
static DMImageCache *instance;
static SDImageCache *instance;
@implementation DMImageCache
@implementation SDImageCache
#pragma mark NSObject
@ -81,11 +81,11 @@ static DMImageCache *instance;
#pragma mark ImageCache (class methods)
+ (DMImageCache *)sharedImageCache
+ (SDImageCache *)sharedImageCache
{
if (instance == nil)
{
instance = [[DMImageCache alloc] init];
instance = [[SDImageCache alloc] init];
}
return instance;

View File

@ -1,6 +1,6 @@
/*
* This file is part of the DMWebImage package.
* (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com>
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
@interface DMWebImageDownloader : NSOperation
@interface SDWebImageDownloader : NSOperation
{
NSURL *url;
id target;

View File

@ -1,16 +1,16 @@
/*
* This file is part of the DMWebImage package.
* (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com>
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "DMWebImageDownloader.h"
#import "SDWebImageDownloader.h"
static NSOperationQueue *downloadQueue;
@implementation DMWebImageDownloader
@implementation SDWebImageDownloader
@synthesize url, target, action;
@ -22,7 +22,7 @@ static NSOperationQueue *downloadQueue;
+ (id)downloaderWithURL:(NSURL *)url target:(id)target action:(SEL)action
{
DMWebImageDownloader *downloader = [[[DMWebImageDownloader alloc] init] autorelease];
SDWebImageDownloader *downloader = [[[SDWebImageDownloader alloc] init] autorelease];
downloader.url = url;
downloader.target = target;
downloader.action = action;

View File

@ -1,6 +1,6 @@
/*
* This file is part of the DMWebImage package.
* (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com>
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@ -8,12 +8,12 @@
#import <UIKit/UIKit.h>
@class DMWebImageDownloader;
@class SDWebImageDownloader;
@interface DMWebImageView : UIImageView
@interface SDWebImageView : UIImageView
{
UIImage *placeHolderImage;
DMWebImageDownloader *downloader;
SDWebImageDownloader *downloader;
}
- (void)setImageWithURL:(NSURL *)url;

View File

@ -1,16 +1,16 @@
/*
* This file is part of the DMWebImage package.
* (c) Dailymotion - Olivier Poitrey <rs@dailymotion.com>
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import "DMWebImageView.h"
#import "DMImageCache.h"
#import "DMWebImageDownloader.h"
#import "SDWebImageView.h"
#import "SDImageCache.h"
#import "SDWebImageDownloader.h"
@implementation DMWebImageView
@implementation SDWebImageView
- (void)dealloc
{
@ -41,7 +41,7 @@
self.image = placeHolderImage;
}
UIImage *cachedImage = [[DMImageCache sharedImageCache] imageFromKey:[url absoluteString]];
UIImage *cachedImage = [[SDImageCache sharedImageCache] imageFromKey:[url absoluteString]];
if (cachedImage)
{
@ -49,7 +49,7 @@
}
else
{
downloader = [[DMWebImageDownloader downloaderWithURL:url target:self action:@selector(downloadFinishedWithImage:)] retain];
downloader = [[SDWebImageDownloader downloaderWithURL:url target:self action:@selector(downloadFinishedWithImage:)] retain];
}
}
@ -59,7 +59,7 @@
self.image = anImage;
// Store the image in the cache
[[DMImageCache sharedImageCache] storeImage:anImage forKey:[downloader.url absoluteString]];
[[SDImageCache sharedImageCache] storeImage:anImage forKey:[downloader.url absoluteString]];
// Free the downloader
[downloader release];