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

# setHidesBackButton(_:animated:)

Hides or shows the Back button, optionally animating the transition.

```
func setHidesBackButton(_ hidesBackButton: Bool, animated: Bool)
```

## Parameters

`hidesBackButton`

Specify <doc://com.apple.documentation/documentation/Swift/true> if the Back button should be hidden when this navigation item is the top item. Specify <doc://com.apple.documentation/documentation/Swift/false> if the Back button should be visible, assuming it hasn’t been replaced by a custom item.

`animated`

<doc://com.apple.documentation/documentation/Swift/true> to animate the transition; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## See Also

[`backItem`](/documentation/UIKit/UINavigationBar/backItem)

The navigation item that is immediately below the topmost item on a navigation bar’s stack.



---

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)