[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
댓글 포인트 안내
첫댓글 포인트
첫 댓글을 작성하는 회원에게 100포인트를 첫댓글포인트로 지급합니다.
지뢰폭탄 포인트
지뢰폭탄이 총10개 매설되어 있습니다.
댓글을 작성하여 지뢰폭탄을 발견하면 최대 100포인트 이내에서 랜덤으로 지뢰제거 보상포인트로 지급합니다.
행운 포인트
댓글을 작성하면 1% 확률로 최대 1000포인트 이내에서 랜덤으로 행운의포인트를 지급합니다.