Generate the corresponding view according to Anntation
-(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;
}
iOS Gold Map Custom annotation Add different pictures