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

# setMenuVisible(_:animated:)

Shows or hides the editing menu, optionally animating the action.

```
func setMenuVisible(_ menuVisible: Bool, animated: Bool)
```

## Parameters

`menuVisible`

<doc://com.apple.documentation/documentation/Swift/true> if the menu should be shown, <doc://com.apple.documentation/documentation/Swift/false> if it should be hidden.

`animated`

<doc://com.apple.documentation/documentation/Swift/true> if the showing or hiding of the menu should be animated, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Before showing the menu, be sure to position it relative to the selection. See [`setTargetRect(_:in:)`](/documentation/UIKit/UIMenuController/setTargetRect(_:in:)) for details. If you do not set the target rect before displaying the menu, it appears at screen coordinates (0.0, 0.0).

---

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)