diff --git a/SDWebImage/SDWebImageManager.h b/SDWebImage/SDWebImageManager.h index b7f44163..736fbba8 100644 --- a/SDWebImage/SDWebImageManager.h +++ b/SDWebImage/SDWebImageManager.h @@ -85,18 +85,21 @@ typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *err * * Here is a simple example of how to use SDWebImageManager: * - * SDWebImageManager *manager = [SDWebImageManager sharedManager]; - * [manager downloadWithURL:imageURL - * delegate:self - * options:0 - * progress:nil - * completed:^(UIImage *image, NSError *error, BOOL fromCache) - * { - * if (image) - * { - * // do something with image - * } - * }]; + * @code + +SDWebImageManager *manager = [SDWebImageManager sharedManager]; +[manager downloadWithURL:imageURL + options:0 + progress:nil + completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished) + { + if (image) + { + // do something with image + } + }]; + + * @endcode */ @interface SDWebImageManager : NSObject @@ -112,11 +115,15 @@ typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *err * The following example sets a filter in the application delegate that will remove any query-string from the * URL before to use it as a cache key: * - * [[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) - * { - * url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; - * return [url absoluteString]; - * }]; + * @code + +[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url) +{ + url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; + return [url absoluteString]; +}]; + + * @endcode */ @property (strong) NSString *(^cacheKeyFilter)(NSURL *url); diff --git a/SDWebImage/UIImageView+WebCache.h b/SDWebImage/UIImageView+WebCache.h index ed6427ac..333ae3e6 100644 --- a/SDWebImage/UIImageView+WebCache.h +++ b/SDWebImage/UIImageView+WebCache.h @@ -14,32 +14,34 @@ * * Usage with a UITableViewCell sub-class: * - * #import - * - * ... - * - * - (UITableViewCell *)tableView:(UITableView *)tableView - * cellForRowAtIndexPath:(NSIndexPath *)indexPath - * { - * static NSString *MyIdentifier = @"MyIdentifier"; - * - * UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; - * - * if (cell == nil) - * { - * cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault - * reuseIdentifier:MyIdentifier] autorelease]; - * } - * - * // Here we use the provided setImageWithURL: method to load the web image - * // Ensure you use a placeholder image otherwise cells will be initialized with no image - * [cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"] - * placeholderImage:[UIImage imageNamed:@"placeholder"]]; - * - * cell.textLabel.text = @"My Text"; - * return cell; - * } - * + * @code + +#import + +... + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *MyIdentifier = @"MyIdentifier"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; + + if (cell == nil) + { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] + autorelease]; + } + + // Here we use the provided setImageWithURL: method to load the web image + // Ensure you use a placeholder image otherwise cells will be initialized with no image + [cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"] + placeholderImage:[UIImage imageNamed:@"placeholder"]]; + + cell.textLabel.text = @"My Text"; + return cell; +} + + * @endcode */ @interface UIImageView (WebCache)