LuxChat  2.0
Instant messenger for iOS
Instance Methods | List of all members
UIImageView(WebCache) Category Reference

#import <UIImageView+WebCache.h>

Instance Methods

(NSURL *) - sd_imageURL
 
(void) - sd_setImageWithURL:
 
(void) - sd_setImageWithURL:placeholderImage:
 
(void) - sd_setImageWithURL:placeholderImage:options:
 
(void) - sd_setImageWithURL:completed:
 
(void) - sd_setImageWithURL:placeholderImage:completed:
 
(void) - sd_setImageWithURL:placeholderImage:options:completed:
 
(void) - sd_setImageWithURL:placeholderImage:options:progress:completed:
 
(void) - sd_setImageWithPreviousCachedImageWithURL:andPlaceholderImage:options:progress:completed:
 
(void) - sd_setAnimationImagesWithURLs:
 
(void) - sd_cancelCurrentImageLoad
 
(void) - sd_cancelCurrentAnimationImagesLoad
 

Detailed Description

Integrates SDWebImage async downloading and caching of remote images with UIImageView.

Usage with a UITableViewCell sub-class:

#import <SDWebImage/UIImageView+WebCache.h>
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]
autorelease];
}
// Here we use the provided sd_setImageWithURL: method to load the web image
// Ensure you use a placeholder image otherwise cells will be initialized with no image
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder"]];
cell.textLabel.text = @"My Text";
return cell;
}

Method Documentation

- (void) sd_cancelCurrentImageLoad

Cancel the current download

- (NSURL *) sd_imageURL

Get the current image URL.

Note that because of the limitations of categories this property can get out of sync if you use sd_setImage: directly.

- (void) sd_setAnimationImagesWithURLs: (NSArray *)  arrayOfURLs

Download an array of images and starts them in an animation loop

Parameters
arrayOfURLsAn array of NSURL
- (void) sd_setImageWithPreviousCachedImageWithURL: (NSURL *)  url
andPlaceholderImage: (UIImage *)  placeholder
options: (SDWebImageOptions)  options
progress: (SDWebImageDownloaderProgressBlock)  progressBlock
completed: (SDWebImageCompletionBlock)  completedBlock 

Set the imageView image with an url and a optionaly placeholder image.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
placeholderThe image to be set initially, until the image request finishes.
optionsThe options to use when downloading the image.
See also
SDWebImageOptions for the possible values.
Parameters
progressBlockA block called while image is downloading
completedBlockA block called when operation has been completed. This block has no return value and takes the requested UIImage as first parameter. In case of error the image parameter is nil and the second parameter may contain an NSError. The third parameter is a Boolean indicating if the image was retrived from the local cache or from the network. The fourth parameter is the original image url.
- (void) sd_setImageWithURL: (NSURL *)  url

Set the imageView image with an url.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
- (void) sd_setImageWithURL: (NSURL *)  url
completed: (SDWebImageCompletionBlock)  completedBlock 

Set the imageView image with an url.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
completedBlockA block called when operation has been completed. This block has no return value and takes the requested UIImage as first parameter. In case of error the image parameter is nil and the second parameter may contain an NSError. The third parameter is a Boolean indicating if the image was retrived from the local cache or from the network. The fourth parameter is the original image url.
- (void) sd_setImageWithURL: (NSURL *)  url
placeholderImage: (UIImage *)  placeholder 

Set the imageView image with an url and a placeholder.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
placeholderThe image to be set initially, until the image request finishes.
See also
sd_setImageWithURL:placeholderImage:options:
- (void) sd_setImageWithURL: (NSURL *)  url
placeholderImage: (UIImage *)  placeholder
completed: (SDWebImageCompletionBlock)  completedBlock 

Set the imageView image with an url, placeholder.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
placeholderThe image to be set initially, until the image request finishes.
completedBlockA block called when operation has been completed. This block has no return value and takes the requested UIImage as first parameter. In case of error the image parameter is nil and the second parameter may contain an NSError. The third parameter is a Boolean indicating if the image was retrived from the local cache or from the network. The fourth parameter is the original image url.
- (void) sd_setImageWithURL: (NSURL *)  url
placeholderImage: (UIImage *)  placeholder
options: (SDWebImageOptions)  options 

Set the imageView image with an url, placeholder and custom options.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
placeholderThe image to be set initially, until the image request finishes.
optionsThe options to use when downloading the image.
See also
SDWebImageOptions for the possible values.
- (void) sd_setImageWithURL: (NSURL *)  url
placeholderImage: (UIImage *)  placeholder
options: (SDWebImageOptions)  options
completed: (SDWebImageCompletionBlock)  completedBlock 

Set the imageView image with an url, placeholder and custom options.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
placeholderThe image to be set initially, until the image request finishes.
optionsThe options to use when downloading the image.
See also
SDWebImageOptions for the possible values.
Parameters
completedBlockA block called when operation has been completed. This block has no return value and takes the requested UIImage as first parameter. In case of error the image parameter is nil and the second parameter may contain an NSError. The third parameter is a Boolean indicating if the image was retrived from the local cache or from the network. The fourth parameter is the original image url.
- (void) sd_setImageWithURL: (NSURL *)  url
placeholderImage: (UIImage *)  placeholder
options: (SDWebImageOptions)  options
progress: (SDWebImageDownloaderProgressBlock)  progressBlock
completed: (SDWebImageCompletionBlock)  completedBlock 

Set the imageView image with an url, placeholder and custom options.

The download is asynchronous and cached.

Parameters
urlThe url for the image.
placeholderThe image to be set initially, until the image request finishes.
optionsThe options to use when downloading the image.
See also
SDWebImageOptions for the possible values.
Parameters
progressBlockA block called while image is downloading
completedBlockA block called when operation has been completed. This block has no return value and takes the requested UIImage as first parameter. In case of error the image parameter is nil and the second parameter may contain an NSError. The third parameter is a Boolean indicating if the image was retrived from the local cache or from the network. The fourth parameter is the original image url.

The documentation for this category was generated from the following files: