我正在使用Google地图,我可以通过使用将地图集中到GMSMarker
GMSCameraPosition *camera =
[[GMSCameraPosition alloc] initWithTarget:marker.position
zoom:MAP_ZOOM_LEVEL
bearing:0
viewingAngle:0];
[mapView animatetoCameraPosition:camera];
我显示一个大小为200 * 150的自定义标注,当相机位置改变时,它的一部分被隐藏,但是我想要将标注放在中央,并且地图指向下方.任何想法如何做到这一点.
解决方法
看看使用
GMSProjection.要将地图的中心从标记位置移动100px,您可以执行以下操作:
- (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;
}