UIImage(Extensions) Category Reference
Declared in | UIImage+Extensions.h |
---|
Overview
UIImage
extension methods. Note the image ‘scale’ property is used to correctly scale/crop etc images with regards to retina screens.
+ maskWithSize:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:
Creates a UIImage
mask of the given size and individual corner radiuses.
+ (UIImage *)maskWithSize:(CGSize)size topLeftRadius:(CGFloat)tl topRightRadius:(CGFloat)tr bottomLeftRadius:(CGFloat)bl bottomRightRadius:(CGFloat)br
Parameters
size |
The size of the mask. |
---|---|
tl |
The corner radius of the top left corner. |
tr |
The corner radius of the top right corner. |
bl |
The corner radius of the bottom left corner. |
br |
The corner radius of the bottom right corner. |
Return Value
The UIImage
mask object.
Discussion
Creates a UIImage
mask of the given size and individual corner radiuses.
Declared In
UIImage+Extensions.h
– imageByFillingMaskWithColor:
Fills all non-transparent parts of the image with the given fill color.
- (UIImage *)imageByFillingMaskWithColor:(UIColor *)fillColor
Parameters
fillColor |
The color to use when filling. |
---|
Return Value
The UIImage
mask object filled with the given color.
Discussion
Fills all non-transparent parts of the image with the given fill color.
Declared In
UIImage+Extensions.h
– tintedImageWithColor:
Tints the image with the given color.
- (UIImage *)tintedImageWithColor:(UIColor *)tintColor
Parameters
tintColor |
The color to tint the image with. |
---|
Return Value
The tinted UIImage
object.
Discussion
Tints the image with the given color.
Declared In
UIImage+Extensions.h
– scaledImageWithSize:
Scales the UIImage
to the given size.
- (UIImage *)scaledImageWithSize:(CGSize)newSize
Parameters
newSize |
The size to scale the |
---|
Return Value
The scaled UIImage
object.
Discussion
Scales the UIImage
to the given size.
Declared In
UIImage+Extensions.h
– croppedImageWithZoom:
Zooms the image by the given zoom factor and then crops to maintain the original size.
- (UIImage *)croppedImageWithZoom:(CGFloat)zoom
Parameters
zoom |
The zoom factor (1.0 = no change). |
---|
Return Value
The zoomed and cropped UIImage
object.
Discussion
Zooms the image by the given zoom factor and then crops to maintain the original size.
Declared In
UIImage+Extensions.h
– aspectRatioImageWithBounds:
Scales the UIImage
to fit the given bounds maintaining the aspect ratio.
- (UIImage *)aspectRatioImageWithBounds:(CGSize)bounds
Parameters
bounds |
The bounds of the new |
---|
Return Value
The scaled UIImage
object.
Discussion
Scales the UIImage
to fit the given bounds maintaining the aspect ratio.
Declared In
UIImage+Extensions.h
– croppedImageWithRect:
Crops the UIImage
to the given frame.
- (UIImage *)croppedImageWithRect:(CGRect)rect
Parameters
rect |
The frame to crop the image to. |
---|
Return Value
The cropped UIImage
object.
Discussion
Crops the UIImage
to the given frame.
Declared In
UIImage+Extensions.h
– circularCroppedImage
Crops the UIImage
to a circle using the smallest dimension as the diameter.
- (UIImage *)circularCroppedImage
Return Value
The cropped UIImage
object.
Discussion
Crops the UIImage
to a circle using the smallest dimension as the diameter.
Declared In
UIImage+Extensions.h
+ decodedImageWithImage:
Decompresses and decodes the UIImage
so that it is ready for fast use.
+ (UIImage *)decodedImageWithImage:(UIImage *)image
Parameters
image |
The |
---|
Return Value
The decompressed and decoded UIImage
object.
Discussion
Decompresses and decodes the UIImage
so that it is ready for fast use.
This is normally done automatically when it needs to be rendered for the first time, but it can be more efficient to do this ahead of time in a thread by using this method.
Declared In
UIImage+Extensions.h