views:

420

answers:

2

I have an interface with a mapView and UITableView. Data is loaded from a server, and the annotations are created and added to the map with

[mapView addAnnotation:truck]

the tableview is then populated using the array thats retured from

[mapView annotations]

once this process is completed, i check the number of annotations on the map with [[mapView annotations] count] called whenever i click on a cell in the table and its equal to the number it ought to be, so all the annotations are getting added onto the mapView, but for some reason I cant see any annotations in the simulator.

The images are named just as they are assigned in the custom AnnotationView, the loadAnnotation function is done properly, etc... i dont know what it could be but ive looked at the associate between the image file and wheres its loaded a hundred times to find a discrepancy, but it all looks fine.

One interesting point is that when i print and coordinate value after clicking on the cell (remember this data comes straight from [mapView annotations], it looks good... but for whatever reason the annotation view isnt being displayed.

so i suppose if i could have the answer to one question it would be, what are possible causes for a mapView to contain several annotations, but to not show any on the map?

Thanks

EDITED WITH IMPORTANT ADDITIONAL INFO

There appears to be a disconnect between what is being displayed on my map in the simulator and what im seeing in the mapView object. For example, when i select a row in the tableView, I am calling:

[mapView setRegion:MKCoordinateRegionMake([annotation coordinate], MKCoordinateSpanMake(.01, .01)) animated:YES];

and this has no effect on the map in the simulator. I have checked that the coordinate being passed is actually a valid coordinate, but it doesnt seem to matter because the map is being unresponsive. I thought it could be something wrong with my .xib, but its all connected properly. delegate is the outlet and mapView as a referencing outlet.

Does anyone now understand what may be happening?

A: 

This really looks like missing images.

Try replacing your custom annotations with MKPinAnnotations to test, and see if your annotations are visible then.

Have you implemented the following delegate function ?

  • (MKAnnotationView*) mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation;
Tom Schulz
A: 

This line:

mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];

was creating messing everything up. once i commented it out, the app began working fine.

culov