use*_*822 0 google-maps map ios
我想点击并按住map以添加引脚google maps api.这是一些教程IOS吗?
GMSMarker *marker;
UILongPressGestureRecognizer您可以像使用MKMapView一样添加到GMSMapView吗?我现在不在Mac上,所以我无法测试这个理论.
如果是这样,请使用locationInView检测屏幕上的触摸位置:
- (void)handleLongPressGesture:(UILongPressGestureRecognizer *)gesture
{
CGPoint pointInView = [gesture locationInView:mapView];
}
Run Code Online (Sandbox Code Playgroud)
然后找到相对于屏幕上的点的位置坐标:
CLLocationCoordinate2D coordinate =
[mapView.projection coordinateForPoint: point];
然后按照Google Maps SDK文档添加标记
GMSMarker *marker = [GMSMarker markerWithPosition:coordinate];
marker.title = @"Hello World";
marker.map = mapView;
Run Code Online (Sandbox Code Playgroud)
希望有所帮助,或让您走上正轨.对不起,我现在无法测试它是否有效!