2012-02-21 4 views
1

내 주 .xib에 시트를로드하는 중 시트가 패널이고 시트를 표시하거나 닫는 데 문제가 없습니다.하지만 닫을 때 오류 메시지가 나타납니다.코코아 beginSheet : didEndSelector 오류가 발생했습니다

2012-02-21 11:10:12.142 CollectionTest2[23277:10b] *** - 
[AppController customSheetDidClose:returnCode:contextInfo:]: unrecognized selector sent to instance 0x359c00 

여기 내 코드입니다 : 당신의 showCustomSheet 방법에서

/*Sheet Methods*/ 

- (void)showCustomSheet: (NSWindow *)window { 

    [NSApp beginSheet: panFilenameEditor modalForWindow: window modalDelegate: self didEndSelector: @selector(customSheetDidClose:returnCode:contextInfo:) contextInfo: nil]; 
} 

- (IBAction)closeCustomSheet:(id)sender { 

    [panFilenameEditor orderOut:self]; 
    [NSApp endSheet:panFilenameEditor]; 
} 

- (void) customSheetDidClose { 

    NSLog(@"sheet did close"); 
} 

답변

1

, 당신은 당신의 애플 리케이션 컨트롤러의 선택 customSheetDidClose:returnCode:contextInfo:를 호출 시트를 말한다. 그러나 그런 방법은 없습니다.

  • 하나가 beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:로 호출 @selector(customSheetDidClose)을 통과 :

    는 두 가지 해결책이 있습니다.

  • customSheetDidCloseMethod의 이름을 - (void)customSheetDidClose:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo으로 바꿉니다.
+0

@DD - 덕분에, 나는 다시 문서를보고 있었지만 이해하지 못했지만 설명은 의미가 있습니다. 앱이 정상적으로 작동합니다. – PruitIgoe