iPhone MapKit: Annotation images get reset back to pins

前端 未结 3 1932
忘了有多久
忘了有多久 2020-12-21 01:37

I\'m adding several annotations to a MapView and using a custom image instead of the default pins. I am using the viewForAnnotation delegate method to set the c

相关标签:
3条回答
  • 2020-12-21 02:25

    Don't use MKPinAnnotationView - just use MKAnnotationView.

    0 讨论(0)
  • 2020-12-21 02:28

    I think I got it. I ended up having to subclass MKAnnotationView.

    0 讨论(0)
  • 2020-12-21 02:39
    MKAnnotationView* pinView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
    
    pinView.animatesDrop=YES;
    pinView.canShowCallout=YES;
    pinView.image=[UIImage imageNamed:@"userMain.png"];
    

    Don't give MKPinAnnotation its takes default pin annotation. Use only MKAnnotationView object and don't use:

    pinView.animatesDrop=YES;
    
    0 讨论(0)
提交回复
热议问题