diff --git a/README.md b/README.md index 24cbdad..62628f9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This library provides a category for UIImageView with support for remote images It provides: -- An UIImageView category adding web image and cache management to the Cocoa Touch framework +- An `UIImageView` category adding web image and cache management to the Cocoa Touch framework - An asynchronous image downloader - An asynchronous memory + disk image caching with automatic cache expiration handling - Animated GIF support @@ -51,14 +51,11 @@ handled for you, from async downloads to caching management. ... -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; - - if (cell == nil) - { + if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease]; } @@ -81,7 +78,9 @@ has completed with success or not: // Here we use the new provided sd_setImageWithURL: method to load the web image [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"] - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {... completion code here ...}]; + completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { + ... completion code here ... + }]; ``` Note: neither your success nor failure block will be call if your image request is canceled before completion. @@ -142,8 +141,7 @@ the image. ```objective-c SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"myNamespace"]; -[imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image) -{ +[imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image) { // image is not nil if image was found }]; ``` @@ -171,8 +169,7 @@ The following example sets a filter in the application delegate that will remove the URL before to use it as a cache key: ```objective-c -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { SDWebImageManager.sharedManager.cacheKeyFilter = ^(NSURL *url) { url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; return [url absoluteString];