我在viewWillLayoutSubviews中使用此代码来设置我的地图的初始区域.
CLLocationCoordinate2D startCoord = CLLocationCoordinate2DMake(13.747266,100.526804); MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:MKCoordinateRegionMakeWithDistance(startCoord,800,800)]; [self.mapView setRegion:adjustedRegion animated:YES]; NSLog(@"%f",adjustedRegion.span.latitudeDelta);
但是,初始缩放级别不起作用.坐标是正确的,但总是放大到最大水平.我检查该区域的跨度,并得到0.0.我该如何解决.
解决方法@H_502_8@
你需要设置你的span.So在这里给你的跨度值.
adjustedRegion.span.longitudeDelta = 0.005;
adjustedRegion.span.latitudeDelta = 0.005;
adjustedRegion.span.longitudeDelta = 0.005; adjustedRegion.span.latitudeDelta = 0.005;