I read the chapter on undo/redo in the Hillegass book. He only goes over document based applications though. I am using pretty much the same code that is in the book, but I get "appController may not respond to -undoManager" when I use the code below. I know that I have to create an Undo Manager explicitly, but exactly how do I do this. Please give me a step by step explanation. Thanks.
-(void)insertObject:(Accounts *)currentAccount inArrayOfAccountsAtIndex:(int)index { NSLog(@"Adding %@ to %@", currentAccount, arrayOfAccounts);
NSUndoManager *undo = [self undoManager];
[[undo prepareWithInvocationTarget:self] removeObjectFromArrayOfAccountsAtIndex: index]; if(![undo isUndoing]){ NSLog(@"After the if(![undo isUndoing]) statement"); [undo setActionName:@"Insert Account"]; } [arrayOfAccounts insertObject:currentAccount atIndex:index]; }