Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode - Programmatically open annotation - MapKit

I have a function which zooms half way into the annotation which has been placed on the map, and the user's location, so that both can be seen on the screen. Is there a method for the annotation which displays its 'contents' i.e. simulate pressing on it? It would be ideal for it to pop open as soon as it's zoomed in.

Thanks in advance.

like image 734
Alex Godbehere Avatar asked May 24 '12 16:05

Alex Godbehere


1 Answers

You can select an annotation with this code: You need to modify the objectAtIndex from 0 to whatever number to display the annotation you wish.

[self.mapView selectAnnotation:[[self.mapView annotations] objectAtIndex:0] animated:YES];
like image 132
Lefteris Avatar answered Nov 07 '22 17:11

Lefteris