Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
11 NSUndoManager
Using NSUndoManager, you can add undo capabilities to your applications in a very elegant manner. As objects are added, deleted, and edited, the undo manager keeps track of all actions that must be taken to undo these changes. As you invoke the undo mechanism, the undo manager keeps track of all actions that must be taken to redo those changes. This mechanism works by maintaining two stacks: one for undo and another for redo. The objects on the stacks are instances of NSInvocation, a class that describes a message send: the receiver, method name, and arguments.
This is a pretty heavy topic to cover so early in a book. (Sometimes when we think about undo, our heads start to swim a bit.) However, undo interacts ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access