Name

NSUndoManager — Mac OS X 10.0

Synopsis

This class provides the basis of Cocoa’s undo and redo system. NSUndoManager supports two kinds of undo: simple undo and invocation-based undo. In simple undo clients register in the undo manager a target and selector that is used to undo the last operation. In invocation based undo the client creates an NSInvocation object that can undo the last operation and record that in the undo manager. In either case, it is the responsibility of the client to specify how the an operation is undone; NSUndoManager simply provides the machinery for keeping track of and executing the supplied selectors or invocations.

image with no caption

@interface NSUndoManager : NSObject
                                  // Accessor Methods
   - (void)setActionName:(NSString *)actionName;
   - (void)setGroupsByEvent:(BOOL)groupsByEvent;
   - (BOOL)groupsByEvent;
   - (void)setRunLoopModes:(NSArray *)runLoopModes;
   - (NSArray *)runLoopModes;
   - (void)setLevelsOfUndo:(unsigned)levels;
   - (unsigned)levelsOfUndo;
                                  // Instance Methods
   - (void)beginUndoGrouping;
   - (BOOL)canRedo;
   - (BOOL)canUndo;
   - (void)disableUndoRegistration;
   - (void)enableUndoRegistration;
   - (void)endUndoGrouping;
   - (void)forwardInvocation:(NSInvocation *)anInvocation;
   - (int)groupingLevel;
   - (BOOL)isRedoing;
   - (BOOL)isUndoRegistrationEnabled;
   - (BOOL)isUndoing;
   - (id)prepareWithInvocationTarget:(id)target;
   - (void)redo;

Get Cocoa in a Nutshell 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.