Format code in document.
This commit is contained in:
parent
5b6e84a953
commit
51bdfdf0b2
|
@ -85,18 +85,21 @@ typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *err
|
||||||
*
|
*
|
||||||
* Here is a simple example of how to use SDWebImageManager:
|
* Here is a simple example of how to use SDWebImageManager:
|
||||||
*
|
*
|
||||||
* SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
* @code
|
||||||
* [manager downloadWithURL:imageURL
|
|
||||||
* delegate:self
|
SDWebImageManager *manager = [SDWebImageManager sharedManager];
|
||||||
* options:0
|
[manager downloadWithURL:imageURL
|
||||||
* progress:nil
|
options:0
|
||||||
* completed:^(UIImage *image, NSError *error, BOOL fromCache)
|
progress:nil
|
||||||
* {
|
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
|
||||||
* if (image)
|
{
|
||||||
* {
|
if (image)
|
||||||
* // do something with image
|
{
|
||||||
* }
|
// do something with image
|
||||||
* }];
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
* @endcode
|
||||||
*/
|
*/
|
||||||
@interface SDWebImageManager : NSObject
|
@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
|
* 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:
|
* URL before to use it as a cache key:
|
||||||
*
|
*
|
||||||
* [[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url)
|
* @code
|
||||||
* {
|
|
||||||
* url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
|
[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url)
|
||||||
* return [url absoluteString];
|
{
|
||||||
* }];
|
url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
|
||||||
|
return [url absoluteString];
|
||||||
|
}];
|
||||||
|
|
||||||
|
* @endcode
|
||||||
*/
|
*/
|
||||||
@property (strong) NSString *(^cacheKeyFilter)(NSURL *url);
|
@property (strong) NSString *(^cacheKeyFilter)(NSURL *url);
|
||||||
|
|
||||||
|
|
|
@ -14,32 +14,34 @@
|
||||||
*
|
*
|
||||||
* Usage with a UITableViewCell sub-class:
|
* Usage with a UITableViewCell sub-class:
|
||||||
*
|
*
|
||||||
* #import <SDWebImage/UIImageView+WebCache.h>
|
* @code
|
||||||
*
|
|
||||||
* ...
|
#import <SDWebImage/UIImageView+WebCache.h>
|
||||||
*
|
|
||||||
* - (UITableViewCell *)tableView:(UITableView *)tableView
|
...
|
||||||
* cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
||||||
* {
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
* static NSString *MyIdentifier = @"MyIdentifier";
|
{
|
||||||
*
|
static NSString *MyIdentifier = @"MyIdentifier";
|
||||||
* UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
|
|
||||||
*
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
|
||||||
* if (cell == nil)
|
|
||||||
* {
|
if (cell == nil)
|
||||||
* cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
{
|
||||||
* reuseIdentifier:MyIdentifier] autorelease];
|
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
|
// Here we use the provided setImageWithURL: method to load the web image
|
||||||
* [cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
|
// Ensure you use a placeholder image otherwise cells will be initialized with no image
|
||||||
* placeholderImage:[UIImage imageNamed:@"placeholder"]];
|
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
|
||||||
*
|
placeholderImage:[UIImage imageNamed:@"placeholder"]];
|
||||||
* cell.textLabel.text = @"My Text";
|
|
||||||
* return cell;
|
cell.textLabel.text = @"My Text";
|
||||||
* }
|
return cell;
|
||||||
*
|
}
|
||||||
|
|
||||||
|
* @endcode
|
||||||
*/
|
*/
|
||||||
@interface UIImageView (WebCache)
|
@interface UIImageView (WebCache)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue