【发布时间】:2018-09-28 07:48:36
【问题描述】:
let camera = GMSCameraPosition.camera(withLatitude: 36.80, longitude: 10.18, zoom: 2.0)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.delegate = self
view = mapView
// Creates a marker in the center of the map.
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: 36.80, longitude: 10.18)
marker.title = "Tunis"
marker.snippet = "Tunisia"
marker.map = mapView
let position = CLLocationCoordinate2D(latitude: 51.5, longitude: -0.127)
let london = GMSMarker(position: position)
london.title = "London"
london.map = mapView
这些是我拥有的标记,单击它时会调用didtapMarker 委托方法,我想获取标记的x、y 值,以便创建一个视图,其中说明了一些信息特定的标记。我该怎么做?
【问题讨论】:
-
你为什么不用info window?
-
如果您想将
coordinates转换为CGPoint,您可以使用var point = mapView.projection.point(for: marker.position)。
标签: ios swift google-maps google-maps-markers