Ich zeige Benutzer Avatar Bilder auf einem MapView. Die Avatare scheinen zu funktionieren, wenn sie ohne Animation gerendert werden, aber ich möchte ihren Drop animieren. Wenn ich pinView.animatesDrop auf true setze, verliere ich den Avatar und er wird durch den Pin ersetzt. Wie kann ich den Drop meines Avatars animieren, ohne den Pin zu benutzen?MKPinAnnotationView benutzerdefiniertes Bild wird durch Pin mit animierenden Tropfen ersetzt
Hier ist meine viewForAnnotation Methode Ich verwende:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
MKPinAnnotationView* pinView = (MKPinAnnotationView*)[self.mapView dequeueReusableAnnotationViewWithIdentifier:@"MyAnnotation"];
if (!pinView) {
pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"CustomPinAnnotation"];
}
else
pinView.annotation = annotation;
//If I set this to true, my image is replaced by the pin
//pinView.animatesDrop = true;
//I'm using SDWebImage
[pinView setImageWithURL:[NSURL URLWithString:@"/pathtosomeavatar.png"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
//Adding a nice drop shadow here
pinView.layer.shadowColor = [UIColor blackColor].CGColor;
pinView.layer.shadowOffset = CGSizeMake(0, 1);
pinView.layer.shadowOpacity = 0.5;
pinView.layer.shadowRadius = 3.0;
return pinView;
}
Bitte siehe http://stackoverflow.com/questions/9814988/mkmapview-instead-of-annotation-pin-a-custom-view – Anna
Annas Link beantwortet meine Frage. http://stackoverflow.com/questions/9814988/mkmapview-instead-of-annotations-pin-a-custom-view –
Anna, bitte geben Sie Ihren Kommentar eine Antwort, so kann ich Ihnen Kredit geben. –