标签:
// 根据anntation生成对应的View
- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation
{
static int a= 0;
if ([annotation isKindOfClass:[POIAnnotation class]])
{
a++;
static NSString *customReuseIndetifier = @"customReuseIndetifier";
MAAnnotationView *annotationView = (MAAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:customReuseIndetifier];
if (annotationView == nil)
{
annotationView = [[MAAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:customReuseIndetifier];
// must set to NO, so we can show the custom callout view.
annotationView.canShowCallout = NO;
annotationView.highlighted = NO;
annotationView.draggable = YES;
annotationView.calloutOffset = CGPointMake(0, -5);
}
annotationView.image = [UIImage imageNamed:[NSString stringWithFormat:@"poi_marker_%d.png",a]];
return annotationView;
}
return nil;
}
标签:
原文地址:http://www.cnblogs.com/liuting-1204/p/5628111.html