0
Hillegass 책에서 실행 취소/다시 실행에 관한 장을 읽었습니다. 그는 단지 문서 기반 응용 프로그램으로 넘어갑니다. 책에있는 코드와 거의 같은 코드를 사용하고 있지만 아래 코드를 사용하면 "appController가 -undoManager에 응답하지 않을 수 있습니다"라는 메시지가 나타납니다. 명시 적으로 실행 취소 관리자를 만들어야한다는 것을 알고 있지만 정확하게 어떻게해야합니까? 제발 단계별 설명을 해주십시오. 감사.NSUndoManager와 관련된 문제
- (무효)은 insertObject : (계정 *) currentAccount inArrayOfAccountsAtIndex : (int)를 인덱스 { NSLog (@ "%의 @에 %의 @ 추가", 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];
}