Ich notiere meine Map und setze ein Bild in Ordnung, aber wenn ich auf die Annotation im MapView tippe, geht das Bild von meinem benutzerdefinierten Bild zurück zum roten Pin. Warum ist das?Warum verschwindet ein benutzerdefiniertes MKMapView-Anmerkungsbild bei Berührung?
- (MKAnnotationView *)mapView:(MKMapView *)newMapView viewForAnnotation:(id)newAnnotation {
MKPinAnnotationView *annotation = [[MKPinAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
if (annotation == nil) {
annotation = [[MKAnnotationView alloc] initWithAnnotation:newAnnotation reuseIdentifier:@"currentloc"];
}
annotation.image = [UIImage imageNamed:@"anno.png"];
annotation.canShowCallout = YES;
annotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bus_stop_30x30.png"]];
annotation.leftCalloutAccessoryView = imgView;
return annotation;
}
Mein Code sieht mit einem Beispielcode identisch aus, der dieses Problem nicht verursacht.
Dank dafür meine Zeit solution..saved .. –