[英]How to delete a polyline in Mapbox iOS SDK?
我可以使用Google在Google地圖中執行此操作
polyline.map = nil
和
mapView.clear()
但我找不到任何相關的方法。
你可以調用mapView.removeAnnotation(polyline)
其中mapView
是您的MGLMapView
, polyline
是MGLPolyline
。
你可能需要跟蹤你的折線,你如何做到這一點取決於你(數組,字典等)
這是我正在使用的MGLMapView
的類擴展方法。 它就像Google Maps SDK
,因此更容易在項目的任何地方使用。
- (void)clear {
if (self.annotations.count > 0) {
NSArray *annotations = self.annotations;
[self removeAnnotations:annotations];
}
}
你可以像使用它一樣
[self.mapView clear];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.