문제

I would like to display annotation callouts automatically after a specific zoom level. However, I do not want to have all the annotation callouts, but only those which are being shown in the screen.

도움이 되었습니까?

해결책

To display annotation callout of those that are visible on screen just the code below should do the trick, as it relies on the selectAnnotation method of MKMapView, of course, after detecting the desired zoom level:

for (MKAnnotation *annotation in mapView.annotations) {
   if ( MKMapRectContainsPoint(mapView.visibleMapRect, MKMapPointForCoordinate(annotation.coordinate)) ) {
       [mapView selectAnnotation:annotation animated:YES];
   }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top