Chapter 20. Undo Management
In this chapter, you learn about undo management support in the iPhone OS. In Section 20.1, we discuss the basic steps needed to utilize undo management. After that, we present a detailed example that shows how to use undo management in Section 20.2. Next, we summarize the main rules in using the undo capabilities in an application in Section 20.3. Finally, we summarize the chapter in Section 20.4.
Understanding Undo Management
In this section, you learn the basic steps needed to add undo capabilities to your application. First, we discuss the basic idea in Section 20.1.1. After that, we talk about the undo manager in Section 20.1.2. Next, you learn in Section 20.1.3 how to register undo/redo operations. After that, you learn in Section 20.1.4 about the role that the first responder plays in the undo management. Section 20.1.4 covers the use of view controllers as first responders to undo requests. Finally, Section 20.1.5 shows what you need to do to enable shake-to-undo behavior.
Basic idea
Undo support provides a simple interface for managing undo/redo of user's actions. Whenever the user requests an operation that they expect to have the option of undoing, you ask an undo manager to record an action that reverts this operation.
Recording undo actions is performed on a stack. The user can shake the device to see the most recent action that can be reverted. If they select that action, the undo operation is executed. In addition, that undo operation can itself ...
Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.