我在嘗試更新具有不同座標的註釋位置時出現問題。有什麼方法可以改變位置屬性而不必創建另一個註釋?我試過下面的代碼,沒有運氣。我試圖得到的註釋沒有更新它的位置。請幫忙!如何用新座標更新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