I'm using MKMapView with many annotations. Everything is OK until i zoom in and zoom out my map. Some annotations' location switch with each others. Anyone know why? Here are my code that i call after viewDidLoad to import annotations from 3 arrays: longitudes, latitudes and photoFileName. photoFileName contains photo file names for all annotations, longitudes and latitudes contain coordinates of them.
for (int i=0; i<[longitudes count]; i++)
CLLocation* location = [[CLLocation alloc] initWithLatitude:[latitudes objectAtIndex:i]
longitude:[longitudes objectAtIndex:i]];
CSMapAnnotation* annotation = [[CSMapAnnotation alloc] initWithCoordinate:[location coordinate]
annotationType:CSMapAnnotationTypeImage
title:@"";
subtitle:@"";
// Set data for the annotation. This data is used for displaying annotation
[annotation setUserData:[photoFilename objectAtIndex:i]];
[_mapView addAnnotation:annotation];
[annotation release];
[currentLocation release];
}
Everything loaded OK, scrolling and zooming worked. However, when I zoom in mapview (about 5-10 times bigger), and after that, zoom out again to the first size, some annotations locations are changed (See the bottom annotation). I don't post the function viewForAnnotation here because it's not called, i just zoom in/out and it happends. http://cC8.upanh.com/27.800.35078007.mF80/1.png http://cC9.upanh.com/27.800.35078008.AWG0/2.png