如何在Google Map iOS Swift中获取经纬度位置的纬度
我试图从谷歌地图视图中的挖掘位置获取CLLocationCoordinate2D对象。 但它总是以-180.0,-180.0为单位,如下所示:
CLLocationCoordinate2D(latitude: -180.0, longitude: -180.0)
我正在使用以下代码:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { let touchpoint = touches.first if let touch = touches.first { var point: CGPoint = touch.locationInView(self.view) let touchMapCoordinate: CLLocationCoordinate2D = MyMapView.projection.coordinateForPoint(point) } }
你可以使用下面的GMSMapView
委托方法。
func mapView(mapView: GMSMapView!, didTapAtCoordinate coordinate: CLLocationCoordinate2D) { println("You have lat and long") }