请查看附件一次。
当我点击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];
更多推荐
如何以编程方式选择地图引脚
发布评论