user1787299
user1787299

Reputation: 21

didSelectAnnotationView call after viewForAnnotation in iOS6

I'm using MapKit in iOS 5 and the function didSelectAnnotationView is correctly called before viewForAnnotation. However, in iOS 6, didSelectAnnotationView gets called after viewForAnnotation. How do I fix it?

Upvotes: 2

Views: 539

Answers (1)

Keilaron
Keilaron

Reputation: 467

Are you sure this is what's happening? I had code that was leading me to the same conclusion initially, until I set my breakpoints in other locations.

If your didSelectAnnotationView (at some point) calls the map view's addAnnotation then it is possible your log messages or breakpoints are misleading you.

The difference I HAVE noticed between iOS5 and iOS6 is that when addAnnotation is used, in iOS5 there is a delay before viewForAnnotation is called whereas in iOS6 it happens immediately. I had to change the order of operations in my code (so that addAnnotation is called last), but otherwise the same code works for both versions of iOS.

Upvotes: 2

Related Questions