使用坐标iOS 3.1.3将MapKitView居中

时间:2011-08-16 13:53:13

标签: ios mapkit

如何在iOS 3.1.3中使用坐标将MapKitView居中。

使用iOS 4. *我使用此代码,但它失败了iOs 3.1.3

    MKCoordinateRegion stopRegion;
    stopRegion.center = coords;
    mapView.region = stopRegion;
    MKCoordinateSpan span;
    span.latitudeDelta = .005;
    span.longitudeDelta = .005;

谢谢!

2 个答案:

答案 0 :(得分:2)

MKCoordinateSpan span;
span.latitudeDelta = .005;
span.longitudeDelta = .005;

MKCoordinateRegion stopRegion;
stopRegion.center = coords;
stopRegion.span = span;

[mapView setRegion:stopRegion animated:YES];

答案 1 :(得分:1)

我找到了一个很好的答案与ios 3和4一起工作:

[mapView setRegion:MKCoordinateRegionMake(coords, MKCoordinateSpanMake(.005, .005)) animated:YES];