Authored by 庞博

Update README.md.

Signed-off-by: 庞博 <bopang@sohu-inc.com>
Showing 1 changed file with 10 additions and 11 deletions
@@ -41,7 +41,7 @@ API documentation is available at [CocoaDocs - SDWebImage](http://cocoadocs.org/ @@ -41,7 +41,7 @@ API documentation is available at [CocoaDocs - SDWebImage](http://cocoadocs.org/
41 41
42 ### Using UIImageView+WebCache category with UITableView 42 ### Using UIImageView+WebCache category with UITableView
43 43
44 -Just #import the UIImageView+WebCache.h header, and call the setImageWithURL:placeholderImage: 44 +Just #import the UIImageView+WebCache.h header, and call the sd_setImageWithURL:placeholderImage:
45 method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be 45 method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be
46 handled for you, from async downloads to caching management. 46 handled for you, from async downloads to caching management.
47 47
@@ -62,8 +62,8 @@ handled for you, from async downloads to caching management. @@ -62,8 +62,8 @@ handled for you, from async downloads to caching management.
62 reuseIdentifier:MyIdentifier] autorelease]; 62 reuseIdentifier:MyIdentifier] autorelease];
63 } 63 }
64 64
65 - // Here we use the new provided setImageWithURL: method to load the web image  
66 - [cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] 65 + // Here we use the new provided sd_setImageWithURL: method to load the web image
  66 + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
67 placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; 67 placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
68 68
69 cell.textLabel.text = @"My Text"; 69 cell.textLabel.text = @"My Text";
@@ -77,10 +77,10 @@ With blocks, you can be notified about the image download progress and whenever @@ -77,10 +77,10 @@ With blocks, you can be notified about the image download progress and whenever
77 has completed with success or not: 77 has completed with success or not:
78 78
79 ```objective-c 79 ```objective-c
80 -// Here we use the new provided setImageWithURL: method to load the web image  
81 -[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] 80 +// Here we use the new provided sd_setImageWithURL: method to load the web image
  81 +[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
82 placeholderImage:[UIImage imageNamed:@"placeholder.png"] 82 placeholderImage:[UIImage imageNamed:@"placeholder.png"]
83 - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {... completion code here ...}]; 83 + completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {... completion code here ...}];
84 ``` 84 ```
85 85
86 Note: neither your success nor failure block will be call if your image request is canceled before completion. 86 Note: neither your success nor failure block will be call if your image request is canceled before completion.
@@ -95,16 +95,15 @@ Here is a simple example of how to use SDWebImageManager: @@ -95,16 +95,15 @@ Here is a simple example of how to use SDWebImageManager:
95 95
96 ```objective-c 96 ```objective-c
97 SDWebImageManager *manager = [SDWebImageManager sharedManager]; 97 SDWebImageManager *manager = [SDWebImageManager sharedManager];
98 -[manager downloadWithURL:imageURL 98 +[manager downloadImageWithURL:imageURL
99 options:0 99 options:0
100 progress:^(NSInteger receivedSize, NSInteger expectedSize) 100 progress:^(NSInteger receivedSize, NSInteger expectedSize)
101 { 101 {
102 // progression tracking code 102 // progression tracking code
103 } 103 }
104 - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)  
105 - {  
106 - if (image) 104 + completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL)
107 { 105 {
  106 + if (image) {
108 // do something with image 107 // do something with image
109 } 108 }
110 }]; 109 }];
@@ -207,7 +206,7 @@ SDWebImage does very aggressive caching by default. It ignores all kind of cachi @@ -207,7 +206,7 @@ SDWebImage does very aggressive caching by default. It ignores all kind of cachi
207 If you don't control the image server you're using, you may not be able to change the URL when its content is updated. This is the case for Facebook avatar URLs for instance. In such case, you may use the `SDWebImageRefreshCached` flag. This will slightly degrade the performance but will respect the HTTP caching control headers: 206 If you don't control the image server you're using, you may not be able to change the URL when its content is updated. This is the case for Facebook avatar URLs for instance. In such case, you may use the `SDWebImageRefreshCached` flag. This will slightly degrade the performance but will respect the HTTP caching control headers:
208 207
209 ``` objective-c 208 ``` objective-c
210 -[imageView setImageWithURL:[NSURL URLWithString:@"https://graph.facebook.com/olivier.poitrey/picture"] 209 +[imageView sd_setImageWithURL:[NSURL URLWithString:@"https://graph.facebook.com/olivier.poitrey/picture"]
211 placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"] 210 placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"]
212 options:SDWebImageRefreshCached]; 211 options:SDWebImageRefreshCached];
213 ``` 212 ```