swift - 使用 NSDictionaryController 和 Swift 时验证用户默认值

标签 swift cocoa-bindings

我有一个带有 NSDictionaryController 的基于 View 的表,其内容绑定(bind)到 Interface Builder 中的 NSUserDefaultsController:

Content binding

在 Swift 中验证字典值的正确方法是什么? (字典键会自动验证,空键会引发错误。我想对字典值执行相同的操作。)

最佳答案

将单元格中文本字段的委托(delegate)设置为表格 View 的委托(delegate)并实现control(_:isValidObject:)

关于swift - 使用 NSDictionaryController 和 Swift 时验证用户默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46257631/

相关文章:

ios - 我怎样才能只显示网站的内容?

cocoa - 使用每行不同的单元格(和数据类型)实现 NSOutlineView/NSTableView

cocoa - 使用绑定(bind)设置 NSBrowserCell 图像?

multithreading - 同时使用 CoreData、多线程和绑定(bind)

cocoa ;将文本字段绑定(bind)到过滤数组的总和(来自 NSArrayController)

ios - 视频方向纵向模式不起作用

ios - 如何添加返回或取消按钮以关闭 UIDocumentBrowser

ios - 在 swift2 中管理页面导航

ios - 使用 [indexPath.section][indexPath.row] 的下标使用不明确

objective-c - 将 nsarraycontroller 绑定(bind)到 nsobjectcontroller、选择、内容的编程等效项