所以我设置了一些调试来记录visibleMapRect
我更改地图视图时的情况。当我以我想要的方式获得视图时,我记下了这些值,并在viewDidLoad
我将 mapView 设置为该矩形。然而,它的看法不一样。它被缩小得更多,所以我正在看的是在屏幕上居中,但屏幕上也有更多。
如何将 mapView 设置为与我设置的相同?
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
MKMapRect mRectHawaii;
mRectHawaii.origin.x = 16077095.369230;
mRectHawaii.origin.y = 117612734.225784;
mRectHawaii.size.width = 698548.708173;
mRectHawaii.size.height = 393548.573271;
[self.mapView setVisibleMapRect:mRectHawaii animated:NO];
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
MKMapRect mRect = mapView.visibleMapRect;
NSLog(@"(%f, %f) (%f, %f)", mRect.origin.x, mRect.origin.y, mRect.size.width, mRect.size.height);
}