实施“搜索”就像 App Store 搜索一样
我正在尝试实现像应用程序商店中使用的搜索一样的搜索。即,当用户输入某些内容(例如“ABC”)时,它会立即开始在外部数据库或其他内容中搜索 ABC... 源代码是否可用于相同或类似的东西?
尽管我在网上找到了 UISearchbar 的示例,但它们大多是在静态数据集上(例如针对预定义的数组项),并且我知道如何实现这种搜索。 然而,就我而言,要搜索的项目无法预定义,因为它们动态地来自 API 调用(以 XML 格式),即如果用户键入“ABC”,我需要将其传递给 NSURL“http://www” .exturl.com/?searchTerm=ABC”,然后它会返回一个 XML 文件,我可以解析该文件并需要显示结果。
我找不到类似的例子,尽管我认为这可能是很常见的事情。
I am trying to implement a search like the one used on the app store. i.e. when a user enters something, say "ABC", it immediately begins searching for ABC in an external database or something...
Is the source code available for the same or for something similar ?
Even though I have found examples of UISearchbar online, they are mostly on static data set (e.g. against a predefined array items) and I know how to implement that kind of Search.
However in my case, the items to search for cannot be predefined, as they come dynamically from a API call (in an XML format) i.e. if the user types "ABC" I need to pass this to an NSURL "http://www.exturl.com/?searchTerm=ABC", which would then return me an XML file that I parse and need to show the results from.
I cannot find an example of something similar, even though I thought this could be soemthing quite common.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定苹果正在使用哪些协议(如 REST、SOAP 等)。
但我知道一件事,在向 AppStore 注册任何应用程序时,他们需要提供一些关键字,对吧?
在 AppStore 中搜索时,它会将单词发送到服务器,并直接按单词而不是按字符检查。所以速度有点快。
所以,我所说的,搜索需要一些时间,我认为这不是问题。
问候,
萨蒂亚
I am not sure the Apple is using which protocols(like REST,SOAP etc).
But one thing I know that, While registering any App to the AppStore, they need to give some key words right?
While searching in the AppStore it will send the words to the server and it directly check in the word wise, not the character wise. So it is some what quick.
So, What I am saying, for searching it will take some time, that is not an issue I think.
Regards,
Satya
您正在谈论实时搜索。为此,请根据您的需要使用协议的委托方法
对其进行编辑,例如,您可以在此方法中发送数据库查询或可以调用任何方法。
如果我不清楚,请告诉我
You are talking about real time searching. For that use this delegate method of protocol
edit it according to your need, For eg, u can send database query in this method or can call any method.
If I am not clear, let me know