tags:

views:

326

answers:

1

Hi All,

I am developing applcation with UISearchBar & TableView. On UISearchBar's text enter event I am reading char. & for entered text I am geeting results from database. But problem is that it is kind of blocking call. so I have wait till result gets back but again I pressess next char. I have to query from database. For each chars enter, I have query with entire text enterd from database. I want to implement AutoCompeltion like google search bar. As In google search bar, to get list for entred chars user has to wait. Iwant that to be implemented in my applcation. I am using iPhoneSDK 3.0. Same thing is running while I am pressing BackSpace. but the problem is that on iPhone Simulatior it application crashes if I press BackSpace continuously.

Can anybody give me hint ???

A: 

You could always implement your text lookup on a separate thread -- it might not offer suggestions as often, but it at least wouldn't block.

If you do this, make sure to "remember" the text the lookup is based on -- then, if the text in the UISearchBar no longer matches it, throw out the results you had -- the will no longer apply.

Example:

The user has typed "bri". Tour lookup determines that possible suggestions are "bridle", "bridge", "bride" and "brigand". If by the time your lookup returns the user has added a 'd', you don't want to suggest "brigand" any more. You don't necessarily have to throw out the whole list, but you want to at least remove the items that no longer work.

Amagrammer