IPhone: MKAnnotation popup?

I have MKMapView, which has an output, than when clicked, the name of the annotation and subtitles is displayed.

Is there a way in the code for this text to be displayed automatically, so the user does not need to click it?

If I have many contacts, can all of them appear?

+4
source share
3 answers

You need to use the selectAnnotation message in MKMapView:

- (void)selectAnnotation:(id <MKAnnotation>)annotation animated:(BOOL)animated 

Selects the specified annotation and displays a leader view for it.

+7
source

This can help:

 - (void)setSelected:(BOOL)selected animated:(BOOL)animated 
+2
source

If your MKMapView is called mapView and your MKAnnotation is called myAnnotation, then this will work:

 [mapView selectAnnotation:myAnnotation animated:YES]; 
0
source

Source: https://habr.com/ru/post/1308947/


All Articles