Authored by niblh
Committed by Olivier Poitrey

Add userInfo on SDWebImageDownloader.m

... ... @@ -19,12 +19,15 @@ extern NSString *const SDWebImageDownloadStopNotification;
id<SDWebImageDownloaderDelegate> delegate;
NSURLConnection *connection;
NSMutableData *imageData;
id userInfo;
}
@property (nonatomic, retain) NSURL *url;
@property (nonatomic, assign) id<SDWebImageDownloaderDelegate> delegate;
@property (nonatomic, retain) NSMutableData *imageData;
@property (nonatomic, retain) id userInfo;
+ (id)downloaderWithURL:(NSURL *)url delegate:(id<SDWebImageDownloaderDelegate>)delegate userInfo:(id)userInfo;
+ (id)downloaderWithURL:(NSURL *)url delegate:(id<SDWebImageDownloaderDelegate>)delegate;
- (void)start;
- (void)cancel;
... ...
... ... @@ -16,12 +16,18 @@ NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNot
@end
@implementation SDWebImageDownloader
@synthesize url, delegate, connection, imageData;
@synthesize url, delegate, connection, imageData, userInfo;
#pragma mark Public Methods
+ (id)downloaderWithURL:(NSURL *)url delegate:(id<SDWebImageDownloaderDelegate>)delegate
{
return [[self class] downloaderWithURL:url delegate:delegate userInfo:nil];
}
+ (id)downloaderWithURL:(NSURL *)url delegate:(id<SDWebImageDownloaderDelegate>)delegate userInfo:(id)userInfo
{
// Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator )
// To use it, just add #import "SDNetworkActivityIndicator.h" in addition to the SDWebImage import
if (NSClassFromString(@"SDNetworkActivityIndicator"))
... ... @@ -38,6 +44,7 @@ NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNot
SDWebImageDownloader *downloader = [[[SDWebImageDownloader alloc] init] autorelease];
downloader.url = url;
downloader.delegate = delegate;
downloader.userInfo = userInfo;
[downloader performSelectorOnMainThread:@selector(start) withObject:nil waitUntilDone:YES];
return downloader;
}
... ... @@ -129,6 +136,7 @@ NSString *const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNot
[url release], url = nil;
[connection release], connection = nil;
[imageData release], imageData = nil;
[userInfo release], userInfo = nil;
[super dealloc];
}
... ...
... ... @@ -6,6 +6,8 @@
* file that was distributed with this source code.
*/
#import <UIKit/UIKit.h>
@class SDWebImageDownloader;
@protocol SDWebImageDownloaderDelegate <NSObject>
... ...