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

# setNavigationBarHidden(_:animated:)

Sets whether the navigation bar is hidden.

```
func setNavigationBarHidden(_ hidden: Bool, animated: Bool)
```

## Parameters

`hidden`

Specify <doc://com.apple.documentation/documentation/Swift/true> to hide the navigation bar or <doc://com.apple.documentation/documentation/Swift/false> to show it.

`animated`

Specify <doc://com.apple.documentation/documentation/Swift/true> if you want to animate the change in visibility or <doc://com.apple.documentation/documentation/Swift/false> if you want the navigation bar to appear immediately.

## Discussion

For animated transitions, the duration of the animation is specified by the value in the [`hideShowBarDuration`](/documentation/UIKit/UINavigationController/hideShowBarDuration) constant.

## See Also

[`isNavigationBarHidden`](/documentation/UIKit/UINavigationController/isNavigationBarHidden)

A Boolean value that indicates whether the navigation bar is hidden.



---

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)