Type Method

commandWithTitle:image:action:propertyList:alternates:

Creates a command with alternative commands.

Declaration

+ (instancetype)commandWithTitle:(NSString *)title image:(UIImage *)image action:(SEL)action propertyList:(id)propertyList alternates:(NSArray<UICommandAlternate *> *)alternates;

Parameters

title

The title to display for the command.

image

The image to display next to the command's title. Only the contextSystem menu system supports the display of an image, and only when the app is running in iOS.

action

The action to take after the user selects the command.

propertyList

An object that contains data to associate with the command.

alternates

An array of alternatives for the command.

Return Value

A newly initialized command object.

See Also

Creating a Command

Adding Menus and Shortcuts to the Menu Bar and User Interface

Provide quick access to useful actions by adding menus and keyboard shortcuts to your Mac app built with Mac Catalyst.