< Previous PageNext Page > Hide TOC

Setting Action Names

NSUndoManager provides the setActionName: method to qualify the Undo and Redo command titles in the Edit menu. You pass the string you want appended to “Undo” and “Redo” in the menu items when the current undo group is at the top of the undo and redo stacks. Take, as an example, a graphics application that allows users to add circles, fill them with a color, and delete them. With this method, you could set the name of each action to “Delete”, “Fill”, and “Add Circle”. Upon successive undos, the Undo menu item shows up as “Undo Delete,” “Undo Fill,” and “Undo Add Circle.”

NSUndoManager automatically localizes the “Undo” and “Redo” portion of the command titles, but merely appends the action name to them. You should localize the action names yourself. If you want to further customize how these titles are localized, override undoMenuTitleForUndoActionName: and redoMenuTitleForUndoActionName:.



< Previous PageNext Page > Hide TOC


© 2002 Apple Computer, Inc. All Rights Reserved. (Last updated: 2002-11-12)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.