one part of my applikation covers an MkMapview. Therefore i load a list of geocode information from my server and place each tuple as a MkAnnotation pin on my map. After being placed each MkAnnotation object will be released. Now i want to search开发者_StackOverflow for a specific MkAnnotation already being placed on my map and if available popup the addtional information bubble.How do i achieve that? Thanks.
There is a property on your MKMapView (from the apple docs):
@property (nonatomic, readonly) NSArray *annotations
It returns an array of annotations and you can search the array for what you need.
Hope this helps!
EDIT:
Also, I just saw that you want to programmatically select an annotation... if you take a look at the selectedAnnotations property on the MKMapView class it says:
Assigning a new array to this property selects the first annotation in the array only.
So you could pass in an Array with your annotation you want selected... I've never tried it but it would seem that it should work based on what the docs say.
精彩评论