Chapter 9. NSUndoManager

Using NSUndoManager, you can add undo capabilities to your applications in a very elegant manner. As objects are added, edited, and deleted, 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 using 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, Third 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.