0

我有 4 个数组,2 个数组由酒店纬度和经度值组成,其余数组由景点纬度和经度值组成。我可以在地图中显示它们。但我无法区分酒店和景点的注释针颜色... ...

4

2 回答 2

0

我认为您应该在添加到地图视图时使用 settag 进行注释,并且在方法 viewForAnotaion 中,您可以通过使用 if 条件或 switch case 获取 TAG 值来设置不同的图像

于 2013-04-19T08:18:02.033 回答
0

你可以试试这个:(在这里我相信你可以区分你想要注释的两个不同类型的实体)。

MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"MyPin"];  
annView.animatesDrop=FALSE;
annView.canShowCallout = YES;
[annView setSelected:YES];

 //YOU CAN CHANGE IMAGE:
if (kSCEntityTypeFirst) {
    annView.image=[UIImage imageNamed:@"SMTL_home_tooltip_red_icon~iphone.png"];
}
else {
    annView.image=[UIImage imageNamed:@"SMTL_home_tooltip_blue_icon~iphone.png"];

}

 //YOU CAN CHANGE COLOR:
if (kSCEntityTypeFirst) {
    annView.pinColor = MKPinAnnotationColorPurple;
}
else {
    annView.pinColor = MKPinAnnotationColorGreen;
}
于 2012-09-12T05:05:35.170 回答