Instance Method


Inserts an item at the specified position in the menu.


- (void)insertItemWithTitle:(NSString *)title atIndex:(NSInteger)index;



The title of the new item. If an item with the same title already exists in the menu, the existing item is removed and the new one is added


The zero-based index at which to insert the item. Specifying 0 inserts the item at the top of the menu.


If you want to move an item, it’s better to invoke removeItemWithTitle: explicitly and then send this method. After adding the item, this method uses the synchronizeTitleAndSelectedItem method to make sure the item displayed matches the currently selected item.

Since this method searches for duplicate items, it should not be used if you are adding an item to an already populated menu with more than a few hundred items. Add items directly to the receiver's menu instead.

See Also

Inserting and deleting items

- addItemWithTitle:

Adds an item with the specified title to the end of the menu.

- addItemsWithTitles:

Adds multiple items to the end of the menu.

- removeAllItems

Removes all items in the receiver’s item menu.

- removeItemWithTitle:

Removes the item with the specified title from the menu.

- removeItemAtIndex:

Removes the item at the specified index.