开发者

Searching in iOS apps

I want to store about 10000 strings in my iOS app. I want the ability to quickly search these strings (similar to searching on the devices themselves when you swipe to the left of the home screen). Searching should include a form of "suggest" or auto-comp开发者_JAVA技巧lete. For example typing "food" into the search box should bring up a list containing "food stores" "food recipes" etc.

How can I implement this type of search? Perhaps a sqlLite database and ... ?

Cheers!


Have a look at Core Data


Depends on a case you can follow two ways:

  1. Integrate Core Data as Diederik Hoogenboom suggested.

  2. Use filteredArrayUsingPredicate method of NSArray and build a predicate for your needs as described in following document Predicate Programming Guide

    I am personally prefer option #2, it is easier to start and depends on solution's performance and memory footprint you can always switch to more complex #1 option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜