小编Mat*_*att的帖子

多个注释阵列,每个阵列的不同引脚颜色?

我的应用程序中有三个注释数组,foodannotations,gasannotations和shoppingnotnotations.我希望每个注释数组都显示不同颜色的引脚.我目前正在使用

- (MKAnnotationView *)mapView:(MKMapView *)sheratonmap viewForAnnotation:(id<MKAnnotation>)annotation {
    NSLog(@"Welcome to the Map View Annotation");

    if([annotation isKindOfClass:[MKUserLocation class]])
        return nil;

    static NSString* AnnotationIdentifier = @"Annotation Identifier";
    MKPinAnnotationView* pinview = [[[MKPinAnnotationView alloc]
                                     initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];

    pinview.animatesDrop=YES;
    pinview.canShowCallout=YES;
    pinview.pinColor=MKPinAnnotationColorPurple;

    UIButton* rightbutton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [rightbutton setTitle:annotation.title forState:UIControlStateNormal];
    [rightbutton addTarget:self action:@selector(showDetails) forControlEvents:UIControlEventTouchUpInside];
    pinview.rightCalloutAccessoryView = rightbutton;

    return pinview;
}
Run Code Online (Sandbox Code Playgroud)

如何将其设置为为每个注释数组使用三种不同的引脚颜色.

谢谢!

iphone annotations mkmapview ios

2
推荐指数
1
解决办法
2822
查看次数

标签 统计

annotations ×1

ios ×1

iphone ×1

mkmapview ×1