ImageLoader Class Reference
Inherits from | NSObject |
Conforms to | NSCacheDelegate |
Declared in | ImageLoader.h |
Overview
The ImageLoader class provides a centralized point for loading images in Titanium. Using ImageLoader is the preferred way for getting images from remote sources.
The class is singleton and not supposed to be subclassed. The instance should not be instantiated directly, but lazily created with sharedLoader.
Tasks
-
+ sharedLoader
Returns the shared instance of image loader.
-
– loadRemote:
Tells the loader to load remote image from URL.
-
– loadImmediateImage:
Tells the loader to return previously loaded image with URL.
-
– loadImmediateImage:withSize:
Tells the loader to return previously loaded image with URL and size.
-
– loadImmediateStretchableImage:
Tells the loader to return previously loaded stretchable image with URL.
-
– loadImmediateStretchableImage:withLeftCap:topCap:
Tells the loader to return previously loaded stretchable image with URL and specified cap values.
-
– fullImageSize:
Returns the full image size.
-
– loadImage:delegate:userInfo:
Tells the loader to load image from URL with delegate.
-
– cancel
Tells the image loader to cancel all activities.
Instance Methods
fullImageSize:
Returns the full image size.
- (CGSize)fullImageSize:(NSURL *)url
Parameters
- url
The image URL
Return Value
The image size.
Declared In
ImageLoader.h
loadImage:delegate:userInfo:
Tells the loader to load image from URL with delegate.
- (ImageLoaderRequest *)loadImage:(NSURL *)url delegate:(NSObject<ImageLoaderDelegate> *)delegate userInfo:(NSDictionary *)userInfo
Parameters
- url
The image URL.
- delegate
The loader delegate.
- userInfo
The additional properties to be assigned to the request.
Return Value
The image load request.
See Also
Declared In
ImageLoader.h
loadImmediateImage:
Tells the loader to return previously loaded image with URL.
- (UIImage *)loadImmediateImage:(NSURL *)url
Parameters
- url
The image URL
Return Value
The loaded image or nil if the image is not available from the cache.
See Also
Declared In
ImageLoader.h
loadImmediateImage:withSize:
Tells the loader to return previously loaded image with URL and size.
- (UIImage *)loadImmediateImage:(NSURL *)url withSize:(CGSize)imageSize
Parameters
- url
The image URL
- imageSize
The required image size.
Return Value
The loaded image or nil if the image is not available from the cache.
See Also
Declared In
ImageLoader.h
loadImmediateStretchableImage:
Tells the loader to return previously loaded stretchable image with URL.
- (UIImage *)loadImmediateStretchableImage:(NSURL *)url
Parameters
- url
The image URL
Return Value
The loaded image or nil if the image is not available from the cache.
See Also
Declared In
ImageLoader.h
loadImmediateStretchableImage:withLeftCap:topCap:
Tells the loader to return previously loaded stretchable image with URL and specified cap values.
- (UIImage *)loadImmediateStretchableImage:(NSURL *)url withLeftCap:(TiDimension)left topCap:(TiDimension)top
Parameters
- url
The image URL
- left
The value to use for the left cap width. Specify 0 if you want the entire image to be horizontally stretchable.
- top
The value to use for the top cap width. Specify 0 if you want the entire image to be vertically stretchable.
Return Value
The loaded image or nil if the image is not available from cache.
See Also
Declared In
ImageLoader.h