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

# setToolbarItems(_:animated:)

Sets the toolbar items to be displayed along with the view controller.

```
func setToolbarItems(_ toolbarItems: [UIBarButtonItem]?, animated: Bool)
```

## Parameters

`toolbarItems`

The toolbar items to display in a built-in toolbar.

`animated`

If <doc://com.apple.documentation/documentation/Swift/true>, animate the change of items in the toolbar.

## Discussion

View controllers that are managed by a navigation controller can use this method to specify toolbar items for the navigation controller’s built-in toolbar. You can set the toolbar items for your view controller before your view controller is displayed or after it is already visible.

---

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)