0
Haritadaki bir noktanın koordinatlarını touchesBegan işlevini ve tapGesture'ı kullanarak bulmaya çalışıyorum ancak aldığım koordinatlar, haritada seçili olandan farklı bir noktayı temsil ediyor. Herhangi bir yardım lütfen?Bir harita üzerinde bir konumun seçilmesi yanlış koordinatlar veriyor
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
let tapGesture = UITapGestureRecognizer(target: self, action: nil)
let touchPoint = tapGesture.locationInView(self.myMap)
let location = self.myMap.convertPoint(touchPoint, toCoordinateFromView: self.myMap)
let mySpan:MKCoordinateSpan = MKCoordinateSpanMake(0.5, 0.5)
let region:MKCoordinateRegion = MKCoordinateRegionMake(location, mySpan)
self.myMap.setRegion(region, animated: true)
lblLat.text = String(location.latitude)
lblLng.text = String(location.longitude)
}
Değerli khuong291, çok teşekkür ederim. İşe yaradı. – Simon
İyi çalışıyor mu? – Khuong
İyi çalıştı. Teşekkür ederim. – Simon