Class

UIMenuController

The menu interface for the Cut, Copy, Paste, Select, Select All, and Delete commands.

Declaration

@interface UIMenuController : NSObject

Overview

The singleton UIMenuController instance is referred to as the editing menu. When you make this menu visible, UIMenuController positions it relative to a target rectangle on the screen; this rectangle usually defines a selection. The menu appears above the target rectangle or, if there is not enough space for it, below it. The menu’s pointer is placed at the center of the top or bottom of the target rectangle, as appropriate. Be sure to set the tracking rectangle before you make the menu visible. You are also responsible for detecting, tracking, and displaying selections.

The UIResponderStandardEditActions informal protocol declares methods that are invoked when the user taps a menu command. The canPerformAction:withSender: method of UIResponder is also related to the editing menu. A responder implements this method to enable and disable commands of the editing menu just before the menu is displayed. You can force this updating of menu commands’ enabled state by calling the update method.

You can also provide your own menu items via the menuItems property. When you modify the menu items, you can use the update method to force the menu to update its display.

Topics

Getting the Menu Controller Instance

sharedMenuController

Returns the menu controller.

Showing and Hiding the Menu

setMenuVisible:

The visibility of the editing menu.

Deprecated
- setMenuVisible:animated:

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

Deprecated

Positioning the Menu

menuFrame

Returns the frame of the editing menu.

arrowDirection

The direction the arrow of the editing menu is pointing.

UIMenuControllerArrowDirection

The direction the arrow of the editing menu is pointing.

- setTargetRect:inView:

Sets the area in a view above or below which the editing menu is positioned.

Deprecated

Updating the Menu

- update

Updates the appearance and enabled state of menu commands.

Customizing Menu Items

menuItems

The custom menu items for the editing menu.

Notifications

UIMenuControllerWillShowMenuNotification

Posted by the menu controller just before it shows the menu.

UIMenuControllerDidShowMenuNotification

Posted by the menu controller just after it shows the menu.

UIMenuControllerWillHideMenuNotification

Posted by the menu controller just before it hides the menu.

UIMenuControllerDidHideMenuNotification

Posted by the menu controller just after it hides the menu.

UIMenuControllerMenuFrameDidChangeNotification

Posted when the frame of a visible menu changes.

Relationships

Inherits From

See Also

Inline Edit Menus

UIMenuItem

A custom item in the editing menu managed by the menu controller.

UIResponderStandardEditActions

A set of standard methods that apps can adopt to support editing.