Είμαι εμφάνιση προσαρμοσμένες εικόνες στο χάρτη (αντί για τις προεπιλεγμένες ακίδες) με τη χρήση του παρακάτω κώδικα. Ωστόσο, όταν πατήσετε σε ένα αντικείμενο (και εμφανίζεται η επεξήγηση), η εικόνα επανέρχεται στην προεπιλεγμένη κόκκινο pin. Πώς μπορώ να έθιμο μου εικόνα, ακόμα και όταν εμφανιστεί η επεξήγηση;
- (MKAnnotationView *) mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
MKPinAnnotationView *pinAnnotation = nil;
if (annotation != mapView.userLocation)
{
static NSString *pinID = @mapPin;
pinAnnotation = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:pinID];
if (pinAnnotation == nil)
pinAnnotation = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pinID] autorelease];
// Set the image
pinAnnotation.image = [UIImage imageNamed:@TestIcon.png];
// Set ability to show callout
pinAnnotation.canShowCallout = YES;
// Set up the disclosure button on the right side
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
pinAnnotation.rightCalloutAccessoryView = infoButton;
[pinID release];
}
return pinAnnotation;
[pinAnnotation release];
}













