remove Annotation removes random amount of annotations at a time
Posted
by skinny123
on Stack Overflow
See other posts from Stack Overflow
or by skinny123
Published on 2010-04-30T15:41:02Z
Indexed on
2010/04/30
15:57 UTC
Read the original article
Hit count: 299
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]];
}
}
© Stack Overflow or respective owner