Instance Method


Invoked to let the delegate update a menu item before it is displayed.


- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel;



The menu object that owns item.


The menu-item object that may be updated.


The integer index of the menu item.


Set to YES if, due to some user action, the menu no longer needs to be displayed before all the menu items have been updated. You can ignore this flag, return YES, and continue; or you can save your work (to save time the next time your delegate is called) and return NO to stop the updating.

Return Value

YES to continue the process. If you return NO, your menu:updateItem:atIndex:shouldCancel: is not called again. In that case, it’s your responsibility to trim any extra items from the menu.


If your numberOfItemsInMenu: delegate method returns a positive value, then your menu:updateItem:atIndex:shouldCancel: method is called for each item in the menu. You can then update the menu title, image, and so forth for each menu item.

See Also

Updating Menu Layout

- confinementRectForMenu:onScreen:

Invoked to allow the delegate to specify a display location for the menu.