• 북마크
  • 추가메뉴
어디로 앱에서 쉽고 간편하게!
애플 중고 거래 전문 플랫폼
오늘 하루 보지 않기
KMUG 케이머그

팁사용기

[팁] Chapter 7의 8쪽에서의 질문....(Cocoa Programming for Mac OS X 2/E)

본문

- (void)insertObject:(Person *)p inEmployeesAtIndex:(int)index
{
// 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 0
로그인 후 추천 또는 비추천하실 수 있습니다.
포인트 38,308
가입일 :
2005-08-18 19:01:33
서명 :
미입력
자기소개 :
미입력

최신글이 없습니다.

최신글이 없습니다.

댓글목록 0

등록된 댓글이 없습니다.
전체 11 건 - 1 페이지