【问题标题】:GMSMarker not aligned to a userGMSMarker 未与用户对齐
【发布时间】:2018-12-21 16:56:11
【问题描述】:

我的 GMSMarker 出现了一些问题,它似乎与用户没有正确对齐。见下图:标记未对齐

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

代码如下:

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

【问题讨论】:

  • 用相关代码提问
  • 会做@PrashantTukadiya
  • @AlvinQuezon 设置 groundAnchor = CGPoint (0.5,0.5)
  • 嗨@chiragshah 是的,很有帮助!谢谢你,无论如何,你能否回答这个问题,以便其他人知道这一点?我会投票给你的答案。谢谢!
  • @AlvinQuezon 一定让我回答

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


【解决方案1】:

你可以用 groundAnchor 属性做到这一点

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

【讨论】:

  • @AlvinQuezon 是可能的,请投票并接受答案
猜你喜欢
  • 2017-04-16
  • 2014-08-03
  • 1970-01-01
  • 1970-01-01
  • 2019-03-15
  • 1970-01-01
  • 2017-01-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多