---
title: "setToolbarItems(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiviewcontroller/settoolbaritems(_:animated:)"
---

# setToolbarItems(_:animated:)

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

## Declaration

```swift
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

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.

## See Also

### Configuring a navigation interface

- [navigationItem](uikit/uiviewcontroller/navigationitem.md)
- [hidesBottomBarWhenPushed](uikit/uiviewcontroller/hidesbottombarwhenpushed.md)
- [toolbarItems](uikit/uiviewcontroller/toolbaritems.md)
