Type Method

animatedResizableImageNamed(_:capInsets:resizingMode:duration:)

Creates and returns an animated image with end caps and a specific resizing mode.

Declaration

class func animatedResizableImageNamed(_ name: String, capInsets: UIEdgeInsets, resizingMode: UIImage.ResizingMode, duration: TimeInterval) -> UIImage?

Parameters

name

The full or partial path to the file (sans suffix).

capInsets

The values to use for the cap insets.

resizingMode

The mode with which the interior of the image is resized.

duration

The duration of the animation.

Return Value

A new animated image object with the specified cap insets and resizing mode.

Discussion

This method is exactly the same as its counterpart animatedResizableImageNamed(_:capInsets:duration:) except that the resizing mode of the new image object can be explicitly declared. Since the resizing mode of an image is UIImage.ResizingMode.tile by default, this method should only be used in place of its counterpart to create an animated image that needs to be resized with the UIImage.ResizingMode.stretch resizing mode.

See Also

Creating Specialized Image Objects

class func animatedImage(with: [UIImage], duration: TimeInterval) -> UIImage?

Creates and returns an animated image from an existing set of images.

func imageFlippedForRightToLeftLayoutDirection() -> UIImage

Returns the current image, prepared to flip horizontally when it’s in a right-to-left layout.

func withHorizontallyFlippedOrientation() -> UIImage

Returns a version of the image whose image orientation is the mirror of the original image.

func withRenderingMode(UIImage.RenderingMode) -> UIImage

Creates and returns a new image object with the specified rendering mode.

func withAlignmentRectInsets(UIEdgeInsets) -> UIImage

Returns a new version of the image that uses the specified alignment insets.

func resizableImage(withCapInsets: UIEdgeInsets) -> UIImage

Creates and returns a new image object with the specified cap insets.

func resizableImage(withCapInsets: UIEdgeInsets, resizingMode: UIImage.ResizingMode) -> UIImage

Creates and returns a new image object with the specified cap insets and options.