如何使MGLPolyline渐开线? [英] How to make a MGLPolyline tapable?
问题描述
我目前正在寻找一种使路线(MGPLPolyline)可点击的方式,以便用户可以在Mapbox下的两条可能的路线之间进行选择.不幸的是,路由注释似乎根本无法被点击:
I am currently looking for a way to make a route (MGPLPolyline) tappable such that a user can choose between two possible routes under Mapbox. Unfortunately the route annotation doesn't seem to be tappable at all:
虽然我已经正确设置了MGLMapViewDelegate
这种方法:
While i have properly set my MGLMapViewDelegate
this method:
func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation)
永远不会被调用.
我想知道每行都是从MGLPolyline
继承而来的,这是MGLAnnotation
的子类(我希望它可以被点击...).
What did i miss knowing that each line inherited from MGLPolyline
which is a subclass of an MGLAnnotation
(which i was expected to be tappable...).
推荐答案
不幸的是,Mapbox iOS API不支持该功能. 请参见此处.
The Mapbox iOS API doesn't support that yet, unfortunately. See here.
该链接中有几种解决方法,您可以尝试.
There are a couple of workarounds within that link that you could try though.
更新: 现在可以进行以下操作:在此处检查.
UPDATE: This is now possible: Check here.
这篇关于如何使MGLPolyline渐开线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!