我在尝试更新具有不同坐标的注释位置时出现问题。有什么方法可以改变位置属性而不必创建另一个注释?我试过下面的代码,没有运气。我试图得到的注释没有更新它的位置。请帮忙!如何用新坐标更新MKAnnotation位置?
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
}
}
谢谢大家!
此解决方案不起作用。请参阅http://stackoverflow.com/questions/2256177/how-to-move-a-mkannotation-without-adding-removing-it-from-the-map/5017332#5017332 – Willster 2011-02-16 13:59:56