Skip to content

Commit 51bdfdf

Browse files
author
BB9z
committed
Format code in document.
1 parent 5b6e84a commit 51bdfdf

File tree

2 files changed

+52
-43
lines changed

2 files changed

+52
-43
lines changed

SDWebImage/SDWebImageManager.h

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,21 @@ typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *err
8585
*
8686
* Here is a simple example of how to use SDWebImageManager:
8787
*
88-
* SDWebImageManager *manager = [SDWebImageManager sharedManager];
89-
* [manager downloadWithURL:imageURL
90-
* delegate:self
91-
* options:0
92-
* progress:nil
93-
* completed:^(UIImage *image, NSError *error, BOOL fromCache)
94-
* {
95-
* if (image)
96-
* {
97-
* // do something with image
98-
* }
99-
* }];
88+
* @code
89+
90+
SDWebImageManager *manager = [SDWebImageManager sharedManager];
91+
[manager downloadWithURL:imageURL
92+
options:0
93+
progress:nil
94+
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished)
95+
{
96+
if (image)
97+
{
98+
// do something with image
99+
}
100+
}];
101+
102+
* @endcode
100103
*/
101104
@interface SDWebImageManager : NSObject
102105

@@ -112,11 +115,15 @@ typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *err
112115
* The following example sets a filter in the application delegate that will remove any query-string from the
113116
* URL before to use it as a cache key:
114117
*
115-
* [[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url)
116-
* {
117-
* url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
118-
* return [url absoluteString];
119-
* }];
118+
* @code
119+
120+
[[SDWebImageManager sharedManager] setCacheKeyFilter:^(NSURL *url)
121+
{
122+
url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path];
123+
return [url absoluteString];
124+
}];
125+
126+
* @endcode
120127
*/
121128
@property (strong) NSString *(^cacheKeyFilter)(NSURL *url);
122129

SDWebImage/UIImageView+WebCache.h

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,34 @@
1414
*
1515
* Usage with a UITableViewCell sub-class:
1616
*
17-
* #import <SDWebImage/UIImageView+WebCache.h>
18-
*
19-
* ...
20-
*
21-
* - (UITableViewCell *)tableView:(UITableView *)tableView
22-
* cellForRowAtIndexPath:(NSIndexPath *)indexPath
23-
* {
24-
* static NSString *MyIdentifier = @"MyIdentifier";
25-
*
26-
* UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
27-
*
28-
* if (cell == nil)
29-
* {
30-
* cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
31-
* reuseIdentifier:MyIdentifier] autorelease];
32-
* }
33-
*
34-
* // Here we use the provided setImageWithURL: method to load the web image
35-
* // Ensure you use a placeholder image otherwise cells will be initialized with no image
36-
* [cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
37-
* placeholderImage:[UIImage imageNamed:@"placeholder"]];
38-
*
39-
* cell.textLabel.text = @"My Text";
40-
* return cell;
41-
* }
42-
*
17+
* @code
18+
19+
#import <SDWebImage/UIImageView+WebCache.h>
20+
21+
...
22+
23+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
24+
{
25+
static NSString *MyIdentifier = @"MyIdentifier";
26+
27+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
28+
29+
if (cell == nil)
30+
{
31+
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]
32+
autorelease];
33+
}
34+
35+
// Here we use the provided setImageWithURL: method to load the web image
36+
// Ensure you use a placeholder image otherwise cells will be initialized with no image
37+
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
38+
placeholderImage:[UIImage imageNamed:@"placeholder"]];
39+
40+
cell.textLabel.text = @"My Text";
41+
return cell;
42+
}
43+
44+
* @endcode
4345
*/
4446
@interface UIImageView (WebCache)
4547

0 commit comments

Comments
 (0)