[App 개발] Chapter 7의 8쪽에서의 질문....(Cocoa Programming for Mac OS X 2/E)
본문
{
// Add the inverse of this operation to the undo stack
NSUndoManager *undo = [self undoManager];
[[undo prepareWithInvocationTarget:self]
removeObjectFromEmployeesAtIndex:index];
if (![undo isUndoing]) {
[undo setActionName:@"Insert Person"];
}
// Add the Person to the array
[employees insertObject:p atIndex:index];
}
- (void)removeObjectFromEmployeesAtIndex:(int)index
{
Person *p = [employees objectAtIndex:index];
// Add the inverse of this operation to the undo stack
NSUndoManager *undo = [self undoManager];
[[undo prepareWithInvocationTarget:self] insertObject:p
inEmployeesAtIndex:index];
if (![undo isUndoing]) {
[undo setActionName:@"Delete Person"];
}
[employees removeObjectAtIndex:index];
}
이 메소드들이 Undo, Redo 할 때 사용하는 메소드인 건 알겠는데요.
제가 아무리 봤지만... 이 메소드를 호출하도록 지정한 부분이 그 어디에도 없었는데요.
인터페이스 빌더에서 employees를 바인딩하고 insert:, remove: 지정하는건 보이는데
어떻게 위의 메소드들에 대한 아무런 지정을 안한 채
MyDocument.h, .m 에 작성만 하였는데
작동이 가능한 건지 모르겠어요.
위의 것이 어떻게 된 건지 도대체 몰라서
Chapter 6와 7을 계속 보았는데 이렇다 할 만한 이유를 못찾았어요.
최신글이 없습니다.
최신글이 없습니다.
댓글목록 0