I have an app that fetches web data and stores it in CD-db. So far, FirstViewController (MKMapView) fetches CD-db into NSMutableArray and uses its values to plot locations by getting the array of custom objects from the db. I cycle thru a for loop while creating the annotation (pin). Each pin gets its distance property set from a calculation I use for the distance from userLocation to each pin.
This app runs in a tabbarcontroller and the other tab is a tableview listing of these locations. I get the values for that tableview by fetching the CD-db and getting the array's values at cellForRowAtIndexPath method and putting the values into the cell.textLabel etc...
My question is, since the distances from userLocation to each pin are calculated on the mapview controller, how do I get those distances on the tableview controller?
You could set the mapview controller as the tableview's datasource. That way only one viewcontroller fetches data. Once you build the mapview controller's array of custom objects it can be used to respond to all the tableview datasource calls such as cellForRowAtIndexpath and numberOfRowsInSection