2014-11-08 17:24:46.487 Intelligent Notes[4472:303] APP-reportExceptionthanks, but I need to control my own subviews
2014-11-08 17:24:46.488 Intelligent Notes[4472:303] thanks, but I need to control my own subviews
2014-11-08 17:24:46.494 Intelligent Notes[4472:303] (
0 CoreFoundation 0x00007fff8742b25c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff86b0fe75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8742b10c +[NSException raise:format:] + 204
3 ViewBridge 0x00007fff8691d9a8 -[NSRemoteView addSubview:] + 70
4 Intelligent Notes 0x000000010001aa2c -[Document(TextEditNSDocumentOverrides) prepareSavePanel:] + 2380
有时,当我在 NSDocument 的 savePanel 添加一个按钮以在保存操作结束后关闭应用程序时,我会收到这个奇怪的日志。这个日志让我吃惊!我该如何解决?或者我如何使用可可的保存面板来获得@“不保存”按钮?
- (BOOL)prepareSavePanel:(NSSavePanel *)savePanel {
if (self.noNeedSave) {
NSButton * aBtn = [NSButton new];
[aBtn setButtonType:NSMomentaryLightButton];
[aBtn setBezelStyle:NSRoundedBezelStyle];
[aBtn setFrame:NSMakeRect(40, 10, 100, 24)];
[aBtn setAction:@selector(closeWindowNoSave)];
[aBtn setTarget:self];
[aBtn setTitle:@"Don't Save"];
[aBtn setAlignment:NSCenterTextAlignment];
[savePanel.contentView addSubview:aBtn];
}
return YES;
}