1

まず、ありがとう。次に、それは私の問題、コア コードです。

for(int idx = 0; idx < route0.polyLine.count; idx++)
{
    CLLocationCoordinate2D coordinate = [[route0.polyLine objectAtIndex:idx] coordinate];
    minLat = MIN(minLat, coordinate.latitude);
    minLon = MIN(minLon, coordinate.longitude);
    maxLat = MAX(maxLat, coordinate.latitude);
    maxLon = MAX(maxLon, coordinate.longitude);
}

MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta = 1.06f*(maxLat - minLat);
span.longitudeDelta = 1.06f*(maxLon - minLon);
CLLocationCoordinate2D location;
location.latitude = (minLat + maxLat)/2;
location.longitude = (minLon + maxLon)/2;
region.span=span;
region.center=location;
[_mapView regionThatFits:region];  
[_mapView setRegion:region animated:false];

私の注意は、マップビューの注釈が画面にぴったり合うようにすることですが、注釈が近すぎると表示されます。 ここに画像の説明を入力

4

0 に答える 0