3
A
回答
7
基于约书亚Nozzi和马克Alldritt的答案,完整的解决方案:
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
NSButton *button = [[NSButton alloc] init];
[button setButtonType:NSSwitchButton];
button.title = NSLocalizedString(@"I am a checkbox", @"");
[button sizeToFit];
[openDlg setAccessoryView:button];
openDlg.delegate = self;
[openDlg beginSheetModalForWindow:self.window completionHandler:^(NSInteger result)
{
openDlg.delegate = nil; // TODO: Check if this is necessary
if (result != NSFileHandlingPanelOKButton) return;
BOOL checkboxOn = (((NSButton*)openDlg.accessoryView).state == NSOnState);
// Do something
}];
的NSOpenSavePanelDelegate:
- (void)panelSelectionDidChange:(id)sender {
NSOpenPanel *panel = sender;
NSButton *button = (NSButton*)panel.accessoryView;
// Update button based on panel selection
}
3
NSOpenPanel是NSSavePanel的子类,它有-setAccessoryView:
。
3
要根据所选文件验证您的复选框,您需要执行NSOpenSavePanelDelegate
委托协议中的panelSelectionDidChange:
。然后,您可以查询打开的面板当前选定的文件并根据需要更新您的复选框状态。
+0
+1帮助。 – hpique
相关问题
- 1. 添加复选框到Gridview
- 2. 添加复选框到ComboboxItem
- 3. 添加复选框到gridview
- 4. 动态添加复选框到组框
- 5. 添加复选框到WPF消息框
- 6. 将值添加到复选框字段
- 7. 复选框组添加到数据库
- 8. 添加一个复选框到cxGridDBColumn(DateEdit)
- 9. 将图像添加到winforms复选框
- 10. 将标签添加到复选框cakephp
- 11. 将复选框添加到asp.net RadTreeView ChildNodes?
- 12. 将内容添加到复选框
- 13. 将onCheckChanged添加到动态复选框
- 14. 如何将复选框添加到UITableViewCell?
- 15. 如何添加复选框列到gridview
- 16. 将复选框添加到UniformGrid
- 17. 添加复选框到CheckBoxField字段列
- 18. 将Gif动画添加到复选框
- 19. 无法添加复选框到ToolStrip
- 20. Extjs将复选框添加到container.viewport
- 21. 将复选框列添加到DataGridView中
- 22. Sencha Touch2:将复选框添加到itemTpl
- 23. 将复选框值添加到salesforce
- 24. 将复选框列添加到DataGrid
- 25. 添加复选框到Magento结帐?
- 26. 添加复选框和ID到表? localstorage
- 27. 添加复选框到edittext/textview?
- 28. 将复选框列添加到GridControlEx中
- 29. 一个复选框列添加到GridView
- 30. 的Zend添加复选框多选框
+1指着我在正确的方向。我将在稍后发布完整解决方案的答案。 – hpique