1
我有下面的代碼,並且試圖在地圖上爲longpress添加註釋。 locationInView的類型是'CGPoint',而'annotation.coordinate'需要CLLocationCoordinate2D類型的變量。 什麼是正確的方法將CGPoint轉換爲CLLocationCoordinate2D?Swift:你如何將CGPoint轉換爲CLLocationCoordinate2D
func myGestureFunc(thegesture: UIGestureRecognizer) {
let pointOfInterest = thegesture.locationInView(self.theMap) //CGPoint
let annotation = MKPointAnnotation()
annotation.coordinate = //expects CLLocationCoordinate2D
theMap.addAnnotation(annotation)
}
http://stackoverflow.com/a/34756033/2303865 –