如何以编程方式选择地图引脚

编程入门 行业动态 更新时间:2024-10-09 11:29:28
本文介绍了如何以编程方式选择地图引脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我很喜欢Maps Concept。

请查看附件一次。

当我点击pin我收到消息说欣赏你的笑容或任何文本.....现在我想要...当我们选择表视图时,我需要提出该引脚的消息(与该引脚的用户交互)...

我正在使用这个地图和引脚的代码。

- (void)viewWillAppear:(BOOL )动画 { [super viewWillAppear:YES]; customLocation.latitude = [casesobjc.latitude_string doubleValue]; customLocation.longitude = [casesobjc.longitude_string doubleValue]; MapViewAnnotation * newAnnotation = [[MapViewAnnotation alloc] initWithTitle:casesobjc.locationForMap_string andCoordinate:customLocation]; [mapView addAnnotation:newAnnotation]; } - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation :( id< MKAnnotation>)注释{ MKPinAnnotationView * pin =(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@annotation_ID ]; if(pin == nil){ pin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@annotation_ID]; } else { pin.annotation = annotation; } pin.pinColor = MKPinAnnotationColorPurple; pin.animatesDrop = YES; pin.canShowCallout = YES; 返回针; }

现在我将显示所有的针脚,如下所示。

如何做当我们点击表格视图时,我需要显示该引脚的标题,就像我们选择一个引脚时的显示方式一样?

感谢

解决方案

您要查找的方法是 selectAnnotation:。

在您的 didSelectRowAtIndexPath 中,您必须找到与表格行相关联的注释。

pre $ [mapView selectAnnotation:foundAnnotation animated:

是];

I am new to Maps Concept.

Please find the attached image once.

when i click the "pin" i am getting message says "Admire your smile" or any text..... Now i want like... when we select the table view, i need to raise that message for that pin(with out user interaction for that pin)...

I am using below code for This maps and pins.

-(void) viewWillAppear:(BOOL)animated { [super viewWillAppear:YES]; customLocation.latitude=[casesobjc.latitude_string doubleValue]; customLocation.longitude=[casesobjc.longitude_string doubleValue]; MapViewAnnotation *newAnnotation = [[MapViewAnnotation alloc] initWithTitle:casesobjc.locationForMap_string andCoordinate:customLocation]; [mapView addAnnotation:newAnnotation]; } - (MKAnnotationView *) mapView: (MKMapView *) mapView viewForAnnotation: (id<MKAnnotation>) annotation { MKPinAnnotationView *pin = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier: @"annotation_ID"]; if (pin == nil) { pin = [[MKPinAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: @"annotation_ID"]; } else { pin.annotation = annotation; } pin.pinColor = MKPinAnnotationColorPurple; pin.animatesDrop = YES; pin.canShowCallout=YES; return pin; }

Now i will show all the pins once like below.

How to do When we click on table view i need to show the title for that pin like how we show when we select a pin?

Thanks in Advance

解决方案

The method that you are looking for is selectAnnotation:.

In your didSelectRowAtIndexPath, you have to find the annotation associated with the table row.

Once you find it, you can tell it, to select it by using:

[mapView selectAnnotation:foundAnnotation animated:YES];

更多推荐

如何以编程方式选择地图引脚

本文发布于:2023-11-05 02:57:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559719.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:引脚   方式   地图

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!