How to get the location coordinates of the center of the map image

My requirement is to implement similar functionality for the Hailo application https://appsto.re/us/ED46B.i

I can first orient the user's location to the map view

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { MKAnnotationView* annotationView = [mapView viewForAnnotation:userLocation]; mapViewNearby.centerCoordinate = userLocation.coordinate; annotationView.canShowCallout = YES; } 

Now, what I want to do, if the user scales or crosses the map, I want to find the coordinate of the new center location. And then initiate reverse geocoding. I have already implemented the reverse geocoding part. I am currently trying to find the coordinates of the center location when the user drags or scales the map view. Help is much appreciated

+5
source share
2 answers

Add this delegate method to MKMapView. You can get center coordination with mapView.centerCoordinate.

 -(void) mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{ NSLog(@"%f %f",mapView.centerCoordinate.latitude,mapView.centerCoordinate.longitude); } 
+8
source

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


All Articles