1

我正在创建一个 MKMapView 应用程序,用户可以在其中将注释引脚拖放到任何特定位置。直到现在它的工作。但是我想要的是,当用户单击刷新按钮时,注释针应该转到当前用户的位置。所以在按钮上点击我必须做的,这样the pin should move from dragged location to user's location.

谢谢

4

2 回答 2

0

我只是给你基本的逻辑,可能对你有帮助。

当你的应用程序。那时第一次运行将您当前的lat 和 lon 值添加到特定的 variabel。(然后在继续进行拖放注释的过程之后。

当你点击刷新按钮然后先写

[mapView removeAnnotations:mapView.annotations];

删除您对 mapView 的注释。

然后在从 Your Variablelatitude中获取值之后。并编写代码以添加基于 lat 和 long 变量的注释。longitude

于 2013-03-28T09:37:10.063 回答
0
- (void)moveToCurrentLocation:(id)sender 
{    
 [mymapview setCenterCoordinate:[mymapview.userLocation coordinate] animated:YES];
}

正如 iPatel 在之前的评论中所说,IT 会将地图视图移动到您当前的位置(用户的位置)并删除当前的注释。

于 2013-03-28T10:29:07.293 回答