是否有可能使MGLPolyLines选择? - 斯威夫特,MapBox

问题描述 投票:1回答:1

是否有可能作出MGLPolyLine可触摸/选择/有用户交互?在我的项目,用户需要触摸的折线。还有之前this question要求,但它是由大约2年过时。他们有没有(MapBox)更新呢?

swift swift4 mapbox polyline mglmapview
1个回答
2
投票

我刚刚检查回来,它看起来像这样已经实现,虽然我不知道这Mapbox发布推出了这一点。

如果你看看简单的例子Mapbox,Annotation Models,即演示的MGLPolyline和间隔开的圆形注释,你可以做一个简单的MOD所提供的代码,看看自己。演示如下:

enter image description here

如果你看看到的viewController代码,添加一对夫妇下方折线创建行:

let polyline = CustomPolyline(coordinates: &coordinates, count: UInt(coordinates.count))

polyline.title = "Polyline"               // New line
polyline.subtitle = "Pretty Poly".        // New line

// Set the custom `color` property, later used in the `mapView:strokeColorForShapeAnnotation:` delegate method.
polyline.color = .darkGray

现在,您可以通过点击并看到一个基本的标注:

enter image description here

这个例子子类MGLPolyline(CustomPolyline),因此其外观可以稍微改变,但是这并没有改变与问候到tappability什么。

© www.soinside.com 2019 - 2024. All rights reserved.