nssearchfield 预测不返回带空格的项目
ANY contains $value.lowercaseString
上面是我放入 xib 绑定搜索谓词中的值。
如果我输入一个单词,例如 =>快乐的 它正确返回 如果我输入一个单词,例如 =>祝你好运
,那么我的视图将不再包含结果。尽管幸运确实作为可搜索的数据点存在。
总而言之,它对集合视图中的项目列表进行排序。
我读过这个:
我读过这个:
http://www.cimgf.com/2008/11/25/adding-itunes-style-search-to-your-core-data-application/
但它有点不同步 。
我希望能够将输入到我的 NSSearchField 中的 searchString 并去掉空格,以便我可以将其输入到我的绑定中并对其进行排序 将删除的空白 prediate 与 NSArrayControllers 中排列对象中的每个空白删除项进行比较。
只是不知道该怎么做。
ANY contains $value.lowercaseString
above is the value I place into my xib's bindings search predicate.
if I type in a word such as => happy
it returns correctly
if I type in a word such as => happy luck
then my view no longer will contain the a result. even though happy luck does exist as a searchable data point.
All in all it sorts a list of items in a collection view.
I have read this:
Collapse sequences of white space into a single character and trim string
and I have read this:
http://www.cimgf.com/2008/11/25/adding-itunes-style-search-to-your-core-data-application/
but its kinda not syncing in.
I want to be able to take the searchString entered into my NSSearchField and strip out the spaces so that I can then feed it to my bindings and have it sort the arrangedObjects. Comparing the whitespace stripped prediate against each whitespace stripd item in the NSArrayControllers arrangedObjects.
Just don't get how to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是我将搜索字符串拉为absoluteString,这将%20注入到searchString名称中,而该名称没有根据NSSearchField的谓词正确验证。
所以我使用 path 而不是 abosoluteString 这为谓词比较提供了一个可行的字符串。
the issue was that I was pulling the search string as absoluteString, which injected %20's into the searchString name which didn't validate correctly against the NSSearchField's predicate.
so I used path instead of abosluteString this deals out a workable string for predicate comparison.