How do I update an MKAnnotation location with new coordinates?
Posted
by user345711
on Stack Overflow
See other posts from Stack Overflow
or by user345711
Published on 2010-05-22T05:26:10Z
Indexed on
2010/05/22
6:10 UTC
Read the original article
Hit count: 325
Hi everyone, i'm having problems trying to update an annotation location with different coordinates. Is there any way I can change de location property without having to create another annotation? I've tried the code below with no luck. The annotation i'm trying to get is not updating its location. Please help!
CLLocationCoordinate2D location;
location.latitude = -36.560976;
location.longitude = -59.455807;
for (id annotation in self.mapView.annotations) {
if ([annotation isKindOfClass:[MyAnnotation class]])
{
[annotation setCoords:location]; //setCoords is defined in MyAnnotation class
}
}
Thank you all!
© Stack Overflow or respective owner