如何将GMSMapMarker视图置于坐标中心

时间:2022-03-09 08:41:27

如何将GMSMapMarker视图置于坐标中心

Is there a way to center the orange arrow (a GMSMapMarker) in a coordinate, changing the view frame or something? I'm using Google Maps for iOS. I can rotate the view with an angle, but I want to set the view's center in a custom coordinate.

有没有办法将橙色箭头(GMSMapMarker)置于坐标中心,更改视图框架等?我正在使用Google Maps for iOS。我可以用一个角度旋转视图,但我想在自定义坐标中设置视图的中心。

2 个解决方案

#1


2  

I found the solution using the property groundAnchor of GMSMarker:

我使用GMSMarker的属性groundAnchor找到了解决方案:

_mapMarker.groundAnchor = CGPointMake(0.5,0.5);

_mapMarker.groundAnchor = CGPointMake(0.5,0.5);

#2


0  

I think you can calculate the pixel/degree by using the GMSCoordinateBounds, then you can shift the center bases on your icon size and heading.

我认为您可以使用GMSCoordinateBounds计算像素/度数,然后您可以根据图标大小和标题移动中心。

#1


2  

I found the solution using the property groundAnchor of GMSMarker:

我使用GMSMarker的属性groundAnchor找到了解决方案:

_mapMarker.groundAnchor = CGPointMake(0.5,0.5);

_mapMarker.groundAnchor = CGPointMake(0.5,0.5);

#2


0  

I think you can calculate the pixel/degree by using the GMSCoordinateBounds, then you can shift the center bases on your icon size and heading.

我认为您可以使用GMSCoordinateBounds计算像素/度数,然后您可以根据图标大小和标题移动中心。