The Problem
I have a view that includes a full-screen MKMapView. The bottom half of the MapView is covered with a TableView that has translucent cells so that the map shows through.
When I center on an annotation coordinate, the current location for example, the annotation view is blocked by the TableView.
- (void)centerOnCurrentLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(self.locationManager.location.coordinate, 50000, 50000);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
}
Attempted Solution
I first tried to programmatically shift the map to offset the center, shifting the annotation up. This approach works if I turn off animation, though it's not a simple solution. Nor do I want to turn off animation.
Instead I thought that if I extend the MapView off the top of the screen by the same height as the TableView the center of the MapView would be exactly where I want it. It doesn't work! When I set the center coordinate on the larger MapView the annotation still appears in the center of the screen, not in the center of the larger MapView. It seems like MKMapView is using the view's visible region when calculating its center.
This is what I would expect to see when I center on current location using the enlarged MapView.
If only MKMapView had a centerOffset property that allowed you to shift the center by some CGPoint.
Does anybody have a simple, elegant solution to offset a MapView's center?