如何在谷歌地图上移动标记,如Ola应用程序 [英] How to move marker on the Google Map like Ola app

查看:690
本文介绍了如何在谷歌地图上移动标记,如Ola应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发类似Ola cabs的应用程序。当用户拖动地图时,视图透明视图随着标记移动而出现,当用户停止拖动时,我们必须使gmscamera位置居中,就像ola cab app一样。这是未拖动地图时的图像。

I am working on app the like Ola cabs. When the user drags map the a view transparent view appears with marker moving and when the user stops dragging the we have to centre the gmscamera position same like ola cab app. This the image when the map is not dragged.

拖动后我使用下面的代码获取位置。

after dragging I am getting the location using the below code.

    - (void) mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position {


    latitude = mapView.camera.target.latitude;
     longitude = mapView.camera.target.longitude;

    CLLocationCoordinate2D center = CLLocationCoordinate2DMake(latitude, longitude);


     [self hourelywebsevice:updatedlogintokenstring withlat:latitude withlong:longitude withcoustamerid:updatednamestring];

   // [self hourelywebsevice:@"abc" withlat:latitude withlong:longitude];
    marker.position = center;


}

现在我的问题是如何创建第二个屏幕。

Now my problem is how create second screen.

推荐答案

使用GMSMapView的代表

Use delegates of GMSMapView

- (void) mapView:(GMSMapView *)mapView didDragMarker:(GMSMarker *)marker;
- (void) mapView:(GMSMapView *)mapView didBeginDraggingMarker:(GMSMarker *)marker;
- (void) mapView:(GMSMapView *)mapView didEndDraggingMarker:(GMSMarker *)marker;

这篇关于如何在谷歌地图上移动标记,如Ola应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆