0
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;
}
我必須在保存面板上添加「不保存」按鈕的原因是我想自定義標題欄的「關閉」按鈕,並且我不會在早期找到AppKit的方法。最後我發現可可的方法來完美地解決它:[[self document] canCloseDocumentWithDelegate:self shouldCloseSelector:@selector(document:shouldClose:contextInfo :) contextInfo:NULL]; – 2015-01-08 01:41:26