如何改变mapview iphone的引脚颜色

时间:2010-07-07 07:19:30

标签: iphone map

MyAnnotation *ann1 = [[MyAnnotation alloc] init];

  ann1.coordinate =region.center;


  [mapView addAnnotation:ann1];

现在它的紫色我想要红色

1 个答案:

答案 0 :(得分:2)

实施MKMapViewDelegate协议回调并将实现类设置为地图视图委托

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation {

    MKPinAnnotationView *newAnnotationPin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"simpleAnnotation"] autorelease];
    newAnnotationPin.pinColor = MKPinAnnotationColorRed; // Or Red/Green
    return newAnnotation;

}