Chapter 7. 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 messages that must be sent to undo these changes. As you invoke the undo mechanism, the undo manager keeps track of all messages that must be sent to redo those changes. This mechanism works by utilizing two stacks of NSInvocation objects.

This is a pretty heavy topic to cover so early in a book. (Sometimes when I think about undo, my head starts to swim a bit.) However, undo interacts with the document architecture. If we tackle this work now, you will see in the next chapter how the document architecture is supposed to work.

NSInvocation

As you might ...

Get COCOA PROGRAMMING FOR MAC OS X SECOND EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.