ASNetworkImageNode Class Reference
Inherits from | ASImageNode : ASControlNode : ASDisplayNode : ASDealloc2MainObject |
---|---|
Declared in | ASNetworkImageNode.h |
Overview
ASNetworkImageNode is a simple image node that can download and display an image from the network, with support for a
placeholder image (defaultImage). The currently-displayed image is always available in the inherited ASImageNode
– initWithCache:downloader:
The designated initializer. Cache and Downloader are WEAK references.
- (instancetype)initWithCache:(nullable id<ASImageCacheProtocol>)cache downloader:(id<ASImageDownloaderProtocol>)downloader
Parameters
cache |
The object that implements a cache of images for the image node. Weak reference. |
---|---|
downloader |
The object that implements image downloading for the image node. Must not be nil. Weak reference. |
Return Value
An initialized ASNetworkImageNode.
Discussion
If cache
is nil, the receiver will not attempt to retrieve images from a cache before downloading them.
Declared In
ASNetworkImageNode.h
– init
Convenience initialiser.
- (instancetype)init
Return Value
An ASNetworkImageNode configured to use the NSURLSession-powered ASBasicImageDownloader, and no extra cache.
Declared In
ASNetworkImageNode.h
delegate
The delegate, which must conform to the ASNetworkImageNodeDelegate protocol.
@property (nullable, nonatomic, weak, readwrite) id<ASNetworkImageNodeDelegate> delegate
Declared In
ASNetworkImageNode.h
defaultImage
A placeholder image to display while the URL is loading.
@property (nullable, nonatomic, strong, readwrite) UIImage *defaultImage
Declared In
ASNetworkImageNode.h
URL
The URL of a new image to download and display.
@property (nullable, nonatomic, strong, readwrite) NSURL *URL
Discussion
Changing this property will reset the displayed image to a placeholder (defaultImage) while loading.
Declared In
ASNetworkImageNode.h
– setURL:resetToDefault:
Download and display a new image.
- (void)setURL:(nullable NSURL *)URL resetToDefault:(BOOL)reset
Parameters
URL |
The URL of a new image to download and display. |
---|---|
reset |
Whether to display a placeholder (defaultImage) while loading the new image. |
Declared In
ASNetworkImageNode.h
shouldCacheImage
If URL is a local file, set this property to YES to take advantage of UIKit’s image caching. Defaults to YES.
@property (nonatomic, assign, readwrite) BOOL shouldCacheImage
Declared In
ASNetworkImageNode.h
shouldRenderProgressImages
If the downloader implements progressive image rendering and this value is YES progressive renders of the image will be displayed as the image downloads. Regardless of this properties value, progress renders will only occur when the node is visible. Defaults to YES.
@property (nonatomic, assign, readwrite) BOOL shouldRenderProgressImages
Declared In
ASNetworkImageNode.h
currentImageQuality
The image quality of the current image. This is a number between 0 and 1 and can be used to track progressive progress. Calculated by dividing number of bytes / expected number of total bytes.
@property (nonatomic, assign, readonly) CGFloat currentImageQuality
Declared In
ASNetworkImageNode.h
renderedImageQuality
The image quality (value between 0 and 1) of the last image that completed displaying.
@property (nonatomic, assign, readonly) CGFloat renderedImageQuality
Declared In
ASNetworkImageNode.h