I previously created a custom callout bubble as a subview to the MKAnnotationView because the built in callout is so limited. This requires me to change to centerOffset of the MKAnnotationView when it is selected to account for the size of the callout bubble. This all worked perfectly before iOS 4 came out. Now, with iOS 4, it completely ignores my updating of the centerOffset property and therefore the pin and bubble appear to jump down and to the right (the top left corner of the callout bubble is now at the location where the pin point should be).
Does anyone know why this has changed in iOS 4? Is there something I can do to get the MKMapView to recognize the new centerOffset? Is this a bug that apple introduced?
Thanks for the help!
I have the same problem - centerOffset seems to be taken into account only the first time. It is changed internally, but the view is not moved - so what you need to do is move the view yourself.
You can move the view by adjusting its center with the required offset - the selected view remains aligned at the top-left corner with the unselected view, so you need to realign their centers. Here's my case:
Selected -> Unselected:
Unselected -> Selected:
Where 130 is the difference in height between the views(center point is at the bottom), and 56 is the difference between the X offsets of their centers.
Remember - you still need to change the center offset because it'll be taken into account when zooming.
Hope this helps, I've lost a few hours on this. Remember to submit a bug report to Apple.
Make sure you are using MKAnnotationView and not MKPinAnnotationView! You can't set the centerOffset of a MKPinAnnotationView-object (except if you subclass of course).
I think instead of
centerOffset
you can usesetRegion
which works fine in all versions.