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
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With