在地图上显示之前删除图钉
在地图上显示 Pin 图之前,我必须确保将它们从地图上删除,这样它就不会过度显示,因为显示的过程是放在 viewWillAppear
方法中的。我的相关代码是这样的:
-(void)viewWillAppear:(BOOL)animated{
//before doing anything, i want to remove all Pins
RMMarkerManager *markerManager=[mapView markerManager];
[mapView setDelegate:self];
[mapView setBackgroundColor:[UIColor grayColor]];
[mapView moveToLatLong:currentLocation];
[mapView.contents setZoom: 13];
[self.view addSubview:mapView];
RMMarker *marker=[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"marker-blue.png"]];
[marker setTextForegroundColor:[UIColor blueColor]];
[marker changeLabelUsingText:@"Vous êtes ici"];
[markerManager addMarker:marker
AtLatLong:currentLocation];
[marker release];
}
请问我该怎么做?提前致谢
before displaying Pins on the map, i have to make sure to remove them from the map so that it will never be over displayed because the procedure of displaying is placed in the viewWillAppear
method. My relevant code is this :
-(void)viewWillAppear:(BOOL)animated{
//before doing anything, i want to remove all Pins
RMMarkerManager *markerManager=[mapView markerManager];
[mapView setDelegate:self];
[mapView setBackgroundColor:[UIColor grayColor]];
[mapView moveToLatLong:currentLocation];
[mapView.contents setZoom: 13];
[self.view addSubview:mapView];
RMMarker *marker=[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"marker-blue.png"]];
[marker setTextForegroundColor:[UIColor blueColor]];
[marker changeLabelUsingText:@"Vous êtes ici"];
[markerManager addMarker:marker
AtLatLong:currentLocation];
[marker release];
}
How can i do that please? thanx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需调用
RMMarkerManager
的removeMarkers
方法即可完成,因此将是这样的:It can just be done by calling the
removeMarkers
method of theRMMarkerManager
, so it will be this :