Select a position using draggable map and fixed marker in Google Maps SDK for iOS

随声附和 提交于 2019-12-25 07:47:44

问题


I'm newbie to iOS development and now trying to build a very simple navigation app using Google Maps SDK. So I created a map and centered it to current position of user.

Now I need to implement the following functionality:

  • make a fixed marker that always remains in the center in a screen;
  • let the user move the map, so the fixed marker will be pointed to desired position.
  • to write coordinates of this position in some variable when user taps on marker.

Can someone please advice with some ideas how to achieve this, or with some sample code?


回答1:


For the fixed marker, you can add a small UIButton on top of your map. After the user pans the map and taps your button, you can get the location centered in map

CLLocationCoordinate2D location = mapView.camera.target;


来源:https://stackoverflow.com/questions/21987247/select-a-position-using-draggable-map-and-fixed-marker-in-google-maps-sdk-for-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!