I've got this code to erase an annotations (pins) in my mkmapview without erasing my blue dot (userLocation). The problem is that it erasing the pins I've added in seemingly random numbers. when it's called through an IBAction it removes the first 5 then click again it removes the next 3, then the next 2, then the last one.
When pressed I need it to remove that latest pin...etc. etc.
for (int i = 0;
i < [mapView.annotations count];
i++
)
{ if ([[mapView.annotations objectAtIndex:i] isKindOfClass:[MyAnnotation class]])
{
[mapView removeAnnotation:[mapView.annotations objectAtIndex:i]];
}
}