[英]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.