5

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

I can centered the user location initially on 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 is, If user zoom or traverse through the mapview I want to find coordinate of the new center location. And then initiate reverse geocoding. I have already implement the reverse geocoding part. Currently I am struggling to find the center location coordinates when the user drag or zoom the map view. Help highly appreciated

smartsanja
  • 4,413
  • 9
  • 58
  • 106
  • This demo will sure help you - http://stackoverflow.com/questions/27394656/need-to-add-a-fixed-overlay-like-on-mapview-in-ios/27395137#27395137 – Kampai Jan 29 '15 at 05:47

2 Answers2

8

Add this MKMapView delegate method. You can get the center coordiate with mapView.centerCoordinate.

-(void) mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated{
            NSLog(@"%f %f",mapView.centerCoordinate.latitude,mapView.centerCoordinate.longitude);
    }
LiveBird
  • 114
  • 2
0

How to center my current location in MKMapView?

pruinis
  • 1
  • 3