LCImageResponseSerializer
Objective-C
@interface LCImageResponseSerializer : LCHTTPResponseSerializer
Swift
class LCImageResponseSerializer : LCHTTPResponseSerializer
LCImageResponseSerializer
is a subclass of LCHTTPResponseSerializer
that validates and decodes image responses.
By default, LCImageResponseSerializer
accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:
image/tiff
image/jpeg
image/gif
image/png
image/ico
image/x-icon
image/bmp
image/x-bmp
image/x-xbitmap
image/x-win-bitmap
-
The scale factor used when interpreting the image data to construct
responseImage
. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance.Declaration
Objective-C
@property (nonatomic) CGFloat imageScale;
Swift
var imageScale: CGFloat { get set }
-
Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with
setCompletionBlockWithSuccess:failure:
, as it allows a bitmap representation to be constructed in the background rather than on the main thread.YES
by default.Declaration
Objective-C
@property (nonatomic) BOOL automaticallyInflatesResponseImage;
Swift
var automaticallyInflatesResponseImage: Bool { get set }