I have 3 tabs with tab bar controllers. All the 3 view controllers in the tab bar have navigation controllers to go to other view controllers on their own.
One of the view controllers in the tab bar is with the map and map annotations(map view controller). Those annotations come from the web service based on the current location when the app starts. In the map view controller, there is a navigation bar item(search button) at the top to enable you to search the map for different location. Once you click the search button, the search view controller is pushed on to the navigation stack. After the search is done and new location is found, the new location is presented in the table view in the same search view controller.
My goal is to go back to the map view automatically once the table view item is clicked, and to load the new annotation data on the map based on the newly searched location. Once the map view is displayed again, the old data which were retrieved when the app first started should be replaced with new data obtained from the web. All the 3 view controllers in the tab bar share the annotation data through singleton object.
My question is, what should I do to go back to map view with new data when the user clicks the item in the didSelectRowAtIndexPath method in the search view controller? What is the best way to go back to map view in the tab bar and to load the data again from the web service?
Do I use the 'popViewControllerAnimated' in the search view controller and and then do work in the map view controller 'viewWillAppear' method? How do I pass the latitude and longitude values of the new location to the map view controller from the search view controller? Do I import the map view controller into the search view controller and set the ivar of the map view controller for the latitude and longitude even though the 'search view controller' came into being by being pushed by the 'map view controller'? What is the complication of importing the map view controller into the search view controller since the map view controller is already in the memory?
What I am trying to accomplish is similar to what the free app 'Wikihood' is doing when it searches the map.
Thank you very much.