UIImage
Undocumented
-
Creates an image at a new size size from a square image. - parameter newSize: A CGSize object that represets the size the result image should be. - returns: An optional UIImage of the new size.
Declaration
Swift
func squareImageToSize(newSize: CGSize) -> UIImage?Parameters
newSizeA CGSize object that represets the size the result image should be.
Return Value
An optional UIImage of the new size.
-
Scales an image to a new size. - parameter newSize: a CGSize object that the result UImage size should be. - returns: An optioal UIImage of the new scale.
Declaration
Swift
func scaleToImage(with newSize: CGSize) -> UIImage?Parameters
newSizea CGSize object that the result UImage size should be.
Return Value
An optioal UIImage of the new scale.
-
Sets an image’s translucency. - parameter alpha: A CGFloat that will be the result image’s translucency. - returns: An optional UIImage of the new translucency.
Declaration
Swift
func setTranlucent(with alpha: CGFloat) -> UIImage?Parameters
alphaA CGFloat that will be the result image’s translucency.
Return Value
An optional UIImage of the new translucency.
-
Corrects an image’s orientation. Does nothing if .imageOrientation == UIImageOrientation.up - returns: An optional UIImage.
Declaration
Swift
func correctlyOrientedImage() -> UIImage?Return Value
An optional UIImage.
-
Resizes an image to a new height. - parameter newHeight: A CGFloat that the new image height should be. - returns: An optional UIImage of the new height.
Declaration
Swift
func resizeImage(to newHeight: CGFloat) -> UIImage?Parameters
newHeightA CGFloat that the new image height should be.
Return Value
An optional UIImage of the new height.
-
Center crops an image to the target size. - parameter target: A CGSize that the result crop should be - returns: An optional UIImage crop of the input image.
Declaration
Swift
func centerCropToSize(target: CGSize) -> UIImage?Parameters
targetA CGSize that the result crop should be
Return Value
An optional UIImage crop of the input image.
-
Tints an image with a specified colour. - parameter color: The specified color of the tint the result image should have. - returns: An optional UIImage tinted to the specified colour.
Declaration
Swift
func tintWithColor(color: UIColor) -> UIImage?Parameters
colorThe specified color of the tint the result image should have.
Return Value
An optional UIImage tinted to the specified colour.
View on GitHub
UIImage Extension Reference