[英]Change Annotation Pin custom image in my MKMapView
我是新的。 我想在地图视图中更改Pin图片。 如何更改注释的图像? 我确定我在这里错过了一些东西。
- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *identifier= @"myAnnotation";
if ([annotation isKindOfClass:[MapPin class]]) {
MKAnnotationView *view =
[self.mapview dequeueReusableAnnotationViewWithIdentifier:identifier];
{
view = [[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:identifier];
view.enabled =YES;
view.canShowCallout =YES;
view.image =[UIImage imageNamed:@"imagePin.png"];
}
return view;
}
return nil;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.