我不太确定如何将其写入谷歌,所以我会尝试在这里问一下。我试图使用MapKit在地图上显示仅一个城市的不同路线。有没有办法限制可以在API中使用的世界地图的数量?
任何建议都表示赞赏。
答案 0 :(得分: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和long为中心,使用latDelta和longDelta指定的放大率。这些值越低,您就越接近缩放。
答案 1 :(得分:0)
MKMapView
都会通知其代理人(通过委托方法-mapView:regionWillChangeAnimated:
和
– mapView:regionDidChangeAnimated:
)。也许您可以在这些方法中编写一些代码来检查并查看用户是否已在城市外滚动,如果是,请使用setRegion:animated:
将地图移回正确的边界。