我正在将一张工作表加载到我的主.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");
}
答案 0 :(得分:1)
在showCustomSheet
方法中,您告诉工作表调用应用控制器上的选择器customSheetDidClose:returnCode:contextInfo:
。但是没有这样的方法。
有两种解决方案:
@selector(customSheetDidClose)
传递给beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:
。customSheetDidCloseMethod
重命名为- (void)customSheetDidClose:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
。