user605957
user605957

Reputation: 2489

How do I test if a CLLocationCoordinate2D is visible in the current MKMapView?

I have many pins on my map and I want to animate the callout for the most visible pin. How can I check to see if the CLLocationCoordinate2D of a pin is visible or closest to the center?

Upvotes: 2

Views: 335

Answers (1)

Kamath5687
Kamath5687

Reputation: 92

This might solve ur query

  MKMapPoint userPoint = MKMapPointForCoordinate(_mapView.userLocation.location.coordinate);
    MKMapRect mapRect = _mapView.visibleMapRect;
    BOOL inside = MKMapRectContainsPoint(mapRect, userPoint);

Upvotes: 3

Related Questions