GMSMarker未与用户对齐

时间:2018-07-13 10:20:35

标签: ios swift google-maps google-maps-markers

我的GMSMarker出现了一些问题,看来它与用户的对齐方式不正确。参见下图:标记未对齐

enter image description here

如何将中心与用户位置透视图对齐?

以下代码:

self.contractorMarker.iconView = self.markerImageView(image: UIImage(named: "contractor-marker")!, size: CGSize(width: 30, height: 30))
                                CATransaction.begin()
                                CAAnimation.init().duration = 0.5
                                self.contractorMarker.position = contractorCoordinate
                                CATransaction.commit()
                                self.contractorMarker.map = self.mapView

1 个答案:

答案 0 :(得分:0)

您可以使用groundAnchor属性来实现

self.contractorMarker.groundAnchor = CGPoint(x:0.5, y: 0.5)