在 MKMapVIew 中像 MKPinAnnotation 一样绘制 Pin 查看 Pin
Posted
技术标签:
【中文标题】在 MKMapVIew 中像 MKPinAnnotation 一样绘制 Pin 查看 Pin【英文标题】:Draw Pin like MKPinAnnotation View Pin in MKMapVIew 【发布时间】:2012-06-30 05:55:51 【问题描述】:我想像 MKPinAnnotationView Pin 一样以编程方式绘制 Pin,而不是使用 Pin 图片。如果有人有想法,请帮助我。
谢谢
【问题讨论】:
【参考方案1】:试试这个
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id)注解
if(annotation != mapView.userLocation)
static NSString *defaultPinID = @"PinId1";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil ) pinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"pin1"] autorelease];
//pinView= [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin1"];
//pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
[pinView setImage:[UIImage imageNamed:@"user.png"]];
【讨论】:
以上是关于在 MKMapVIew 中像 MKPinAnnotation 一样绘制 Pin 查看 Pin的主要内容,如果未能解决你的问题,请参考以下文章
如何在 jupyter 中像 pandas Dataframe 一样打印 Pyspark Dataframe