I have a square MKMapView in my app, and I wish to set a center point and the exact height/width of the view in meters.
Creating an MKCoordinateRegion and setting the map to it (as in this code...
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(center_coord, 1000.0, 1000.0);
[self.mapView setRegion:region animated:YES];
..) doesn't work properly because using regions here just means that at least that region is displayed, typically more than the region is.
I'm planning on using setVisibleMapRect:animated: method instead, as I believe this will zoom to the actual MKMapRect passed.
So, is there a simple way to convert between an MKcoordinateRegion and an MKMapRect? Perhaps getting the top-left and bottom-right coordinates of the region, and using them to the make the MKMapRect?
I couldn't see anything handy in the Map Kit Functions Reference.
(Using iOS 5, Xcode 4.2)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…