iOS谷歌地图sdk GMSMarker定位 [英] iOS google maps sdk GMSMarker positioning
本文介绍了iOS谷歌地图sdk GMSMarker定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Google地图,我可以使用
I am working with Google maps and I am able to center the map to the GMSMarker by using
GMSCameraPosition *camera =
[[GMSCameraPosition alloc] initWithTarget:marker.position
zoom:MAP_ZOOM_LEVEL
bearing:0
viewingAngle:0];
[mapView animateToCameraPosition:camera];
我正在显示尺寸为200 * 150的自定义标注,当相机位置时,其中一部分被隐藏已更改,但我希望标注位于中心,地图点位于其下方。任何想法如何做到这一点。
I am showing a custom callout of size 200*150 and part of it gets hidden when the camera position is changed but I want the callout to be in the center and the map point to be below it. Any ideas how to do this.
推荐答案
看一下使用 GMSProjection 。要将地图中心从标记位置移动100px,您可以执行以下操作:
Have a look at using GMSProjection. To shift the center of the map 100px from the markers location you would do something like:
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
CGPoint point = [mapView_.projection pointForCoordinate:marker.position];
point.x = point.x + 100;
GMSCameraUpdate *camera =
[GMSCameraUpdate setTarget:[mapView_.projection coordinateForPoint:point]];
[mapView_ animateWithCameraUpdate:camera];
return YES;
}
这篇关于iOS谷歌地图sdk GMSMarker定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文