0
因此,當我更改我的地圖視圖時,我設置了一些調試以記錄visibleMapRect
。當我以我想要的方式得到視圖時,我記下了這些值,並在viewDidLoad
中將mapView設置爲該矩形。然而它不一樣的看法。它縮小得更多,所以我看到的是以屏幕爲中心,但屏幕上還有更多。MapKit,設置視圖
如何將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);
}
iOS系統版本? – AlexWien
多個版本(6&7) – Justin808
也許'setVisibleMapRect:edgePadding:animated:'是一個解決方案嗎? – Mundi