2

I am developing an iPhone application in which I need to show an image at a specific Latitude & Longitude on a Map. The requirement is - Even if the user zooms in or out on this map screen, the map control should automatically center itself after the zoom, to the same Lat & Long. I am using MKMapView.

I have tried to go through all available documentation. However, I could not come across any callback or other method that will allow me to achieve the objective.

One alternative is to handle touch events. However, I find that as a very complicated solution. And I hope that a simpler alternative exists. Any ideas on the above?

Can you please help? Any example will be appreciated.

Manali
  • 577
  • 4
  • 11
  • Duplicate of your previous question http://stackoverflow.com/questions/3903913/how-to-recenter-map-on-zoom-in-iphone – Claus Broch Oct 13 '10 at 08:07

1 Answers1

0

Implement MKMapViewDelegate and then try this:

- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    [mapView setCenterCoordinate:locationManager.coordinate animated:NO];
}

Replace locationManager with whatever the name of your CLLocationManager is.

Deepak Danduprolu
  • 44,595
  • 12
  • 101
  • 105
NonatomicRetain
  • 301
  • 4
  • 14