我想知道Google Map中绘制的折线是否有水龙头监听器。标记的点击是:
func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
return false
}
折线是否有任何等效功能?我相信在谷歌地图版本3 for web中,您可以为折线添加事件监听器,如下所示:
google.maps.event.addListener(elines[i], 'click', function()
{
lineClick(this);
});
Thanks!
这在ios / swift中也可以吗?
答案 0 :(得分:3)
您可以使用GMSPolyline的void insert_after(Node* head, int oldKey, int newKey){
Node* currNode = NULL;
Node* nextNode = NULL;
Node* newNode = NULL;
if (head == NULL) {
return;
}
currNode = head;
newNode->key = newKey;
while (currNode != NULL) {
if (currNode->key == oldKey) {
// oldKey is anywhere but last node
if (currNode->next != NULL) {
nextNode = currNode->next;
newNode->next = nextNode;
currNode->next = newNode;
break;
}
// oldKey is at the last node
else {
currNode->next = newNode;
newNode->next = NULL;
break;
}
}
currNode = currNode->next;
}
}
属性。
isTappable
如果此叠加层应该导致点击通知。
isTappable
每当点击折线时,都会调用GMSMapViewDelegate方法didTapOverlay
polyline.isTappable = true