MKPinAnnotationView custom Image is replaced by pin with animating drop

前端 未结 2 382
一生所求
一生所求 2020-12-06 17:24

I\'m displaying user avatar images on a MapView. The avatars appear to be working if they are rendered without animation, however I\'d like to animate their drop. If I set p

相关标签:
2条回答
  • 2020-12-06 18:00

    When you want to use your own image for an annotation view, it's best to create a regular MKAnnotationView instead of an MKPinAnnotationView.

    Since MKPinAnnotationView is a subclass of MKAnnotationView, it has an image property but it generally (usually when you don't expect it) ignores it and displays its built-in pin image instead.

    So rather than fighting with it, it's best to just use a plain MKAnnotationView.

    The big thing you lose by not using MKPinAnnotationView is the built-in drop animation which you'll have to implement manually.

    See this previous answer for more details:
    MKMapView: Instead of Annotation Pin, a custom view

    0 讨论(0)
  • 2020-12-06 18:02

    If you're stumbling on to this issue and you're sure that you're MKAnnotationView instead of an MKPinAnnotationView, ensure your MKMapView's delegate property hasn't been nilled.

    0 讨论(0)
提交回复
热议问题