[英]In a macOS Cocoa application, How to show only the first 'x' elements that match a NSPredicate in a NSOutlineView populated with a NSTreeController?
I am developing a macOS proof of concept project. 我正在开发一个macOS概念证明项目。 I have, in the main window, a NSOutlineView populated with a NSTreeController via Cocoa bindings and Core Data.
在主窗口中,我有一个通过Cocoa绑定和Core Data填充了NSTreeController的NSOutlineView。 Under the NSOutlineView, I have a search field and a "Recents" button, a bit like Xcode has in the project navigator.
在NSOutlineView下,我有一个搜索字段和一个“ Recents”按钮,就像项目导航器中的Xcode一样。 My Core Data model object has a "modifiedAt" property and, when the user selects the "Recents" button, I would like to show only the last 10 modified files in the OutlineView.
我的核心数据模型对象具有“ modifiedAt”属性,当用户选择“ Recents”按钮时,我只想在OutlineView中显示最后10个修改的文件。 Any suggestions on how to achieve that ?
关于如何实现这一目标的任何建议? Thank you in advance for any help.
预先感谢您的任何帮助。
将fetchLimit
上的NSFetchRequest
设置为fetchLimit
的数字(在示例中为10)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.