我正在尝试从谷歌地图视图中的点击位置获取 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)
}
}