MKAnnotationView - Lock custom annotation view to pin on location updates

后端 未结 3 1847
灰色年华
灰色年华 2020-11-27 03:06

Update #5 I guess it\'s bounty time. 100+ views and no one\'s taken a stab, even with the code sample I\'ve posted. How about some reputation points!

相关标签:
3条回答
  • 2020-11-27 03:38

    I know you aren't going to like this answer, but it works. The sample you linked to just draws a custom image in the overlay through the most difficult way possible (drawRect:). Have you considered rendering your overlay once into a UIImage, and just setting the image property on a very simple MKAnnotationView? Even if you need to change the content periodically, like updating the number of friends at a bar, you can redraw the image when the change occurs and update the appropriate MKAnnotationView.

    0 讨论(0)
  • 2020-11-27 03:49

    custom callout

    I created a project based on your CalloutMapAnnotationView demonstrating a IB based solution. Arrow keys animate motion of the location annotation and it's callout annotation. The callout now also automatically resizes based on the supplied contentView, and the view is loaded from a separate nib. Good luck!

    https://github.com/jacobjennings/JJMapCallout

    0 讨论(0)
  • 2020-11-27 03:49

    I review your code and my recommendation is to create a new custom MKAnnotationView and encapsulate on it both views (the pin and the callout).

    But for your current code consider read the approved response this question: MKMapView moving Annotations Automatically - animate them?

    Cheers.

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