I'm trying to have a map view centre on one point so the user can smoothly zoom in and out but remain centred on that point.
I've a less than optimal solution by centring the map when regionDidChangeAnimated is called, plus a flag to stop the code looping infinitely...
-(void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
if (!self.isRecentring) {
self.isRecentring = YES;
[mapView setCenterCoordinate:self.centreLocation animated:YES];
self.isRecentring = NO;
}
}
So, that works but only does its thing once the user has finished changing the zoom, meaning there's a quick scroll to reposition the map afterward.
I've tried the equivalent with regionWillChangeAnimated but that just kills the zoom dead, I'm presuming because my setCentreCoordinate sets a new region and ends the zoom gesture?
Any ideas how I can work around this and maintain the centre point mid-zoom?