2013-11-27 144 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]; 

用這種方法我每次都會將我的地圖集中到我想要的位置。 此外,有人可以調整地圖的縮放並達到他想要的結果。