<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIToolbar/setItems(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIToolbar(im)setItems:animated:"
  },
  "title" : "setItems(_:animated:)"
}
-->

# setItems(_:animated:)

Sets the items on the toolbar by animating the changes.

```
func setItems(_ items: [UIBarButtonItem]?, animated: Bool)
```

## Parameters

`items`

The items to display on the toolbar.

`animated`

A Boolean value if set to <doc://com.apple.documentation/documentation/Swift/true> animates the transition to the items; otherwise, does not.

## Discussion

If `animated` is <doc://com.apple.documentation/documentation/Swift/true>, the changes are dissolved or the reordering is animated—for example, removed items fade out and new items fade in. This method also adjusts the spacing between items.

---

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)