0
는 리두는NSUndoManager 다시 실행 prepareWithInvocationTarget
- (void)removeSmth:(Smth *)smth index:(NSInteger)indexOfSmth {
[self.document.undoManager beginUndoGrouping];
...
[self removeSmth:smth];
[[self.document.undoManager prepareWithInvocationTarget:self] undoInsertSmth:smth index:indexOfSmth];
...
[self.document.undoManager endUndoGrouping];
}
- (void)undoInsertSmth:(Smth *)smth index:(NSUInteger)index {
[self insertSmth:smth index:index];
}