This is my question….
I have a mapView and i fill the view with several custom pins.
I would different custom pins in my mapView.
I have tried with an IF condition but don’t work.
I don’t understand how the called to method works.
Follow the code.
Vi allego il codice.
//Customization of my pins
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation(id<MKAnnotation>)annotation{
static NSString *identifier = @"";
MKAnnotationView *pin = [ mappa dequeueReusableAnnotationViewWithIdentifier:identifier ];
//OLD COORDINATES
if(newcoordinate == FALSE){
pin = [[[ MKAnnotationView alloc ] initWithAnnotation:annotation reuseIdentifier:identifier ]autorelease];
pin.image = [ UIImage imageNamed:@"old.png" ]
}
// NEW COORDINATES
else ( newcoordinate == TRUE){
pin = [[[ MKAnnotationView alloc ] initWithAnnotation:annotation reuseIdentifier:identifier ]autorelease];
pin.image = [ UIImage imageNamed:@"new.png" ];
}
pin.canShowCallout = YES;
//CALLOUT INFO
UIImage *image = [UIImage imageNamed:@"informations.png"];
UIImageView *imgView = [[[UIImageView alloc] initWithImage:image]autorelease];
pin.leftCalloutAccessoryView = imgView;
pin.annotation = annotation;
return pin;}
The result is… several pin in the same mapView but with the same customization.
:/
Thank you.
SOLVED.
I have added a new property in MyAnnotation class:
Today i have learned what are the properties.