MKAnnotationView - Lock custom annotation view to pin on location updates MKAnnotationView - Lock custom annotation view to pin on location updates objective-c objective-c

MKAnnotationView - Lock custom annotation view to pin on location updates


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


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.


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.