中心的GMSMarker图标(iOS)

中心的GMSMarker图标(iOS),第1张

概述我刚刚从Apple Maps切换到Google Maps.我似乎找不到答案的问题是,如何使GMSMarker的图标中心开始,而不是从图像的底部开始. 我的意思是,当前位置点图标以其要表达的坐标为中心开始.不过,GMSMarkers图标从图标的底部开始. 您可以使用属性groundAnchor更改您的标记图标的开始位置. Google Maps SDK for iOS文档: The ground 我刚刚从Apple Maps切换到Google Maps.我似乎找不到答案的问题是,如何使GMSMarker的图标从中心开始,而不是从图像的底部开始.

我的意思是,当前位置点图标以其要表达的坐标为中心开始.不过,GMSMarkers图标从图标的底部开始.

解决方法 您可以使用属性groundAnchor更改您的标记图标的开始位置.

Google Maps SDK for iOS文档:

The ground anchor specifIEs the point in the icon image that is
anchored to the marker’s position on the Earth’s surface. This point
is specifIEd within the continuous space [0.0,1.0] x [0.0,1.0],
where (0,0) is the top-left corner of the image,and (1,1) is the
bottom-right corner.

例:

The below example rotates the marker 90°. Setting the groundAnchor
property to 0.5,0.5 causes the marker to be rotated around its center,
instead of its base.

CLLocationCoordinate2D position = CLLocationCoordinate2DMake(51.5,-0.127);CLLocationdegrees degrees = 90;GMSMarker *london = [GMSMarker markerWithposition:position];london.groundAnchor = CGPointMake(0.5,0.5);london.rotation = degrees;london.map = mapVIEw_;
总结

以上是内存溢出为你收集整理的中心的GMSMarker图标(iOS)全部内容,希望文章能够帮你解决中心的GMSMarker图标(iOS)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1112416.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存