【发布时间】:2016-02-24 00:24:52
【问题描述】:
我有以下代码,并试图在地图上为长按添加注释。 locationInView 是“CGPoint”类型,而“annotation.coordinate”需要 CLLocationCoordinate2D 类型的变量。 将 CGPoint 转换为 CLLocationCoordinate2D 的正确方法是什么?
func myGestureFunc(thegesture: UIGestureRecognizer) {
let pointOfInterest = thegesture.locationInView(self.theMap) //CGPoint
let annotation = MKPointAnnotation()
annotation.coordinate = //expects CLLocationCoordinate2D
theMap.addAnnotation(annotation)
}
【问题讨论】: