Merge pull request #1057 from heistings/dev_updateReadMe
Update README.md.
This commit is contained in:
commit
904f552e01
47
README.md
47
README.md
|
@ -41,7 +41,7 @@ API documentation is available at [CocoaDocs - SDWebImage](http://cocoadocs.org/
|
||||||
|
|
||||||
### Using UIImageView+WebCache category with UITableView
|
### Using UIImageView+WebCache category with UITableView
|
||||||
|
|
||||||
Just #import the UIImageView+WebCache.h header, and call the setImageWithURL:placeholderImage:
|
Just #import the UIImageView+WebCache.h header, and call the sd_setImageWithURL:placeholderImage:
|
||||||
method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be
|
method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be
|
||||||
handled for you, from async downloads to caching management.
|
handled for you, from async downloads to caching management.
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@ handled for you, from async downloads to caching management.
|
||||||
reuseIdentifier:MyIdentifier] autorelease];
|
reuseIdentifier:MyIdentifier] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here we use the new provided setImageWithURL: method to load the web image
|
// Here we use the new provided sd_setImageWithURL: method to load the web image
|
||||||
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
|
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
|
||||||
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
|
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
|
||||||
|
|
||||||
cell.textLabel.text = @"My Text";
|
cell.textLabel.text = @"My Text";
|
||||||
return cell;
|
return cell;
|
||||||
|
@ -77,10 +77,10 @@ With blocks, you can be notified about the image download progress and whenever
|
||||||
has completed with success or not:
|
has completed with success or not:
|
||||||
|
|
||||||
```objective-c
|
```objective-c
|
||||||
// Here we use the new provided setImageWithURL: method to load the web image
|
// Here we use the new provided sd_setImageWithURL: method to load the web image
|
||||||
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
|
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
|
||||||
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
|
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
|
||||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {... 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.
|
Note: neither your success nor failure block will be call if your image request is canceled before completion.
|
||||||
|
@ -95,19 +95,18 @@ Here is a simple example of how to use SDWebImageManager:
|
||||||
|
|
||||||
```objective-c
|
```objective-c
|
||||||
SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
||||||
[manager downloadWithURL:imageURL
|
[manager downloadImageWithURL:imageURL
|
||||||
options:0
|
options:0
|
||||||
progress:^(NSInteger receivedSize, NSInteger expectedSize)
|
progress:^(NSInteger receivedSize, NSInteger expectedSize)
|
||||||
{
|
{
|
||||||
// progression tracking code
|
// progression tracking code
|
||||||
}
|
}
|
||||||
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
|
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL)
|
||||||
{
|
{
|
||||||
if (image)
|
if (image) {
|
||||||
{
|
// do something with image
|
||||||
// do something with image
|
}
|
||||||
}
|
}];
|
||||||
}];
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Asynchronous Image Downloader Independently
|
### Using Asynchronous Image Downloader Independently
|
||||||
|
@ -207,9 +206,9 @@ SDWebImage does very aggressive caching by default. It ignores all kind of cachi
|
||||||
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:
|
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:
|
||||||
|
|
||||||
``` objective-c
|
``` objective-c
|
||||||
[imageView setImageWithURL:[NSURL URLWithString:@"https://graph.facebook.com/olivier.poitrey/picture"]
|
[imageView sd_setImageWithURL:[NSURL URLWithString:@"https://graph.facebook.com/olivier.poitrey/picture"]
|
||||||
placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"]
|
placeholderImage:[UIImage imageNamed:@"avatar-placeholder.png"]
|
||||||
options:SDWebImageRefreshCached];
|
options:SDWebImageRefreshCached];
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add a progress indicator
|
### Add a progress indicator
|
||||||
|
|
Loading…
Reference in New Issue