I have situation where I have an MKMapView that takes up the full view of my xib file. Over the top of this (at the left hand side of the xib) I have a tableView.
I'm adding a number of annotations to my map, which is fine, and then the map is centered so these are all in view. The problem I have is that the map is centered based on the size of the whole view. What I would like to do is center the region in the visible part of the map - so basically add an offset that is the size of the tableView's frame. The reason the mapView takes up the whole size of the view is that the tableView can be dismissed so the user views the map full screen. The tableView doesn't start at 0,0 and take up the whole height so you can see the map behind it (which is why I don't just make the map's frame larger when dismissing the table view).
I've been trying to use
[mapView convertPoint:point toCoordinateFromView:mapView]
and then try and work out the difference between my currently selected region but this doesn't seem to be working.
Any help appreciated
CGPoint offset = CGPointMake(tableView.frame.size.width,self.tableView.frame.size.height);
CLLocationCoordinate2D movedLocation =[self.mapView convertPoint:offset toCoordinateFromView:self.mapView];
// Not sure what I should do here
// hardCodedLocation.latitude = hardCodedLocation.latitude - (hardCodedLocation.latitude - movedLocation.latitude);
CLLocationDistance zoom = 900000;
[self.mapView setRegion:MKCoordinateRegionMakeWithDistance(hardCodedLocation, zoom, zoom) animated:YES ];