1
我已經在使用方法GMSGeometryContainsLocation
來確定座標(來自抽頭用戶)是否在GMSPolygon內,但是我無法使它適用於GMSPolyline。如果抽頭點是不完全的多線則GMSGeometryIsLocationOnPath
條件將永遠不會返回trueiOS - 確定座標是否在GMSPolyline內
-(void) mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate
{
if (_myMarker)
_myMarker.map = nil;
[self didTapOnPolygon:coordinate andMap:mapView];
[self didTapOnPolyline:coordinate andMap:mapView];
}
如果您的'didTapOnPolyline'委託觸發,那麼用戶正在點擊'多段線'權利?那麼爲什麼檢查點是否在線? – Subramanian
這是我的自定義方法。查看編輯 – Balanced
如果分接點不完全在多義線上,那麼它將不起作用。你可以通過使用'GMSGeometryIsLocationOnPathTolerance'來檢查點在多邊線上還是附近。 – Subramanian