2013-11-27 145 views
0

我必须设置我的离线地图,这个地图已经用tilemill集中在一个自定义点上。虽然我没有找到像setMapion这样的方法来为我做这份工作。有没有办法将区域设置为rmmapview地图?RMMapView地图设置区域

回答

1

不,像ios这样的区域在路由图中不可用。您可以设置限制,让用户倾斜滚动出你的地图:

// Constrain our map so the user can only browse through our exported map tiles 
[self.mapView setConstraintsSW:CLLocationCoordinate2DMake(self.mapSrc.bottomRightOfCoverage.latitude, self.mapSrc.topLeftOfCoverage.longitude) 
         NE:CLLocationCoordinate2DMake(self.mapSrc.topLeftOfCoverage.latitude, self.mapSrc.bottomRightOfCoverage.longitude)]; 

当然和滚动到特定位置:

[self.mapView moveToLatLong:self.currentPosition.coordinate]; 
+0

根据编译器,moveToLatLong方法不存在。这是我必须自己做的一种方法吗?此外,当我调用setConstraintsSW方法时,我得到了内存错误的错误访问。 – hoya21

+0

我用它与ios6,不知道它是否适用于当前的ios/xcode版本。我在RMMapView头文件中有moveToLatLong方法定义。您是否使用了https://github.com/route-me/route-me – thorb65

+0

中的lib它已经通过MapBox API更改为moveToCoordinate方法,并且包含在RMShape.h中。我要检查这个库,我会通知你。 – hoya21

0

我解决我的问题与下面的代码:

CLLocationCoordinate2D centerOfMap = CLLocationCoordinate2DMake(latitude, longitude); 

[mapView setCenterCoordinate:centerOfMap]; 

用这种方法我每次都会将我的地图集中到我想要的位置。 此外,有人可以调整地图的缩放并达到他想要的结果。