I am making Map application and I have already able to call web service which show Shops location on map with annotation. My web service contain more than 200 shops in Australia. I am taking one UISearch bar in which when I insert Syd…..then Sydney, Australia kind of addresses autofill tableview should open. How can I achieve this.. Do I need to call web service Url again for address autofill tablview or Should I insert manually address or is there any method???
Edited:=
In my application I am searching shops location within 5,10,15Km of radius. And if user want another location instead of current location then he can insert his any location to find shops information around that inserted location. So when user insert his location then autofill address tableview should open
One possible solution can be to keep the predefined values in database (Core Data) and then on textDidChange delegate of searchBar you can query the database to search for a list if data matching the current serach keyword. The results thus produced can be shown in a table view with some animation effect so as to give the feel of auto suggest.
Calling the webservice on textDidChange will block the User Interface and will not be good option to proceed with. though this feature is more prevalent on web but on device I find the first choice more productive than the second one.
EDIT: Answer for problem being asked in edit part of question
Now to provide functionality of address suggestion like “Syd” turning into Sydney, Australia , my above answer will help you to put these static addresses in database and then providing user with auto suggest options. For the second part you can save the lat/long of the places in database and once user finalize his selection you can query the webservice to get you the data.
The steps can be summarized as ..
Sydney,Australia.
along with the names in above query)and query your web service to
fetch you data for
Place = Sydny, Australia (Not really Required)
Latitude = SOME VALE for Sydney
Longitude – SOME VALUE for Sydney
Radius = 5,10,15 depending upon your application logic
Server will then fetch you all shops in given range for particular Lat/long.
More calculation intensive work can be done at server’s end and at client’s end less web service calls should be made to avoid latency.