2011-02-09 45 views
0

我并不太确定如何将这个词转化为谷歌,所以我会试着在这里提出。我试图使用MapKit在地图上显示不同的路线只有一个城市。有没有办法限制可以在API中使用的世界地图的数量?只能在一个城市使用MapKit

任何建议表示赞赏。

回答

1

如果您添加到viewDidLoad中:

MKCoordinateRegion region={{0.0,0.0,},{0,0.0}}; 
region.center.latitude = 30.44; 
region.center.longitude = -84.31; 
region.span.latitudeDelta=0.03; 
region.span.longitudeDelta=0.03; 
[mapView setRegion:region animated:YES]; 
[mapView setMapType:MKMapTypeStandard]; 
[mapView setZoomEnabled:YES]; 
[mapView setScrollEnabled:NO]; 
[mapView setDelegate:self]; 

它会围绕lat和长,由latDelta和longDelta指定的放大倍率。这些值越低,缩放得越近。

0

MKMapView只要滚动地图就会通知其代理人(通过代理方法-mapView:regionWillChangeAnimated:– mapView:regionDidChangeAnimated:)。也许你可以在这些方法中编写一些代码来检查用户是否在城市外滚动,如果是,使用setRegion:animated:将地图移回到正确的边界。