如何创建过滤主表视图的 iTunes 风格源列表?
我读过一些关于如何模仿 iTunes 源列表样式的帖子。但我似乎无法弄清楚需要做什么才能让它们在主表视图中实际显示其他内容。
我的设置是这样的:我在后台有核心数据,其中包含 iTunes 中的所有曲目和具有 3 个状态的“状态”字符串。我只想在选择源列表中的项目时显示部分标题。源列表项与轨道的状态相匹配。 换句话说:3 个源列表项代表一个数据集中的 3 个不同组。这些组通过该状态变量进行区分。
我尝试创建一个 NSStrings 和 NSPredicates 数组,并将所选项目绑定到主表视图过滤谓词。但这没有用。
非常感谢您的回复。
编辑:现在可以从数组设置过滤谓词。但这对于过滤表的 NSSearch 字段来说效果不佳。还有其他方法或者我可以轻松组合这两个谓词吗?
I have read some threads about how to imitate the iTunes source list style. But I cannot seem to figure out what needs to be done to let them actually show other things in the main table view.
My setup is this: I have core data in the background containing all the tracks from iTunes and a "state" string that has 3 states. I want to only show parts of the titles on selecting an item in the source list. The source list items match the states of the tracks.
In other words: 3 source list items representing 3 different groups within one dataset. The groups are differentiated with this state variable.
I have tried to make an array of NSStrings and NSPredicates and bind the selected item to the main table views filtering predicate. But it did not work.
Thank you very much for your reply.
EDIT: Setting filter predicates from an array works now. But this does not play well with NSSearch fields that filter the table. Is there another way or can I combine the two predicates easily?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过“OR”或“AND”将两个谓词“组合”在一起。换句话说,假设您有这两个谓词:
您可以执行以下操作:
或者
You can "combine" two predicates by "OR"ing or "AND"ing them together. In other words, let's say you have these two predicates:
You can do:
Or