2
我想將自定義註釋針添加到多段線的開始點和結束點。但我無法想象如何做到這一點。這是我的地圖的圖像。添加自定義註釋針
我要添加綠色標註引腳上的折線的起點或終點。
這裏是我的代碼
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if (annotation==mapView.userLocation) {
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"currAnno"];
if (annotationView == nil) {
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currAnno"];
}
annotationView.canShowCallout=YES;
annotationView.image = [UIImage imageNamed:@"mapPin.png"];
return annotationView;
}else{
static NSString *viewId = @"MKAnnotationView";
MKAnnotationView *annotationView = (MKAnnotationView*)
[mapView dequeueReusableAnnotationViewWithIdentifier:viewId];
if (annotationView == nil) {
annotationView = [[MKAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:viewId];
}
annotationView.canShowCallout=YES;
annotationView.image = [UIImage imageNamed:@"mapPin.png"];//set your image here
return annotationView;
}
}