1

我正在将工作表加载到我的主 .xib 中,工作表是一个面板,显示或关闭工作表没有问题,但是当我关闭它时,我收到一条错误消息:

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

这是我的代码:

/*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");
} 
4

1 回答 1

1

在您的showCustomSheet方法中,您告诉工作表调用customSheetDidClose:returnCode:contextInfo:应用控制器上的选择器。但是没有这样的方法。

有两种解决方案:

  • 要么将@selector(customSheetDidClose)您的电话传递给beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:.
  • 或将您的重命名customSheetDidCloseMethod- (void)customSheetDidClose:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo.
于 2012-02-21T17:08:53.940 回答