---
title: "setMenuVisible(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uimenucontroller/setmenuvisible(_:animated:)"
---

# setMenuVisible(_:animated:)

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

## Declaration

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

Discussion Before showing the menu, be sure to position it relative to the selection. See 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).

## See Also

### Showing and hiding the menu

- [showMenu(from:rect:)](uikit/uimenucontroller/showmenu(from:rect:).md)
- [hideMenu(from:)](uikit/uimenucontroller/hidemenu(from:).md)
- [hideMenu()](uikit/uimenucontroller/hidemenu().md)
- [isMenuVisible](uikit/uimenucontroller/ismenuvisible.md)
