<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIImage/animatedResizableImageNamed(_:capInsets:resizingMode:duration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImage(cm)animatedResizableImageNamed:capInsets:resizingMode:duration:"
  },
  "title" : "animatedResizableImageNamed(_:capInsets:resizingMode:duration:)"
}
-->

# animatedResizableImageNamed(_:capInsets:resizingMode:duration:)

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

```
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:)`](/documentation/UIKit/UIImage/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`](/documentation/UIKit/UIImage/ResizingMode-swift.enum/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`](/documentation/UIKit/UIImage/ResizingMode-swift.enum/stretch) resizing mode.

## See Also

[`resizableImage(withCapInsets:)`](/documentation/UIKit/UIImage/resizableImage(withCapInsets:))

Returns a new version of the image with the specified cap insets.

[`resizableImage(withCapInsets:resizingMode:)`](/documentation/UIKit/UIImage/resizableImage(withCapInsets:resizingMode:))

Returns a new version of the image with the specified cap insets and options.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)