2014-11-11 11 views

Antwort

32

Ich habe es herausgefunden.

Wenn mapView Region ändert, erhalten die Lat und Lon von CLLocationCoordinate2D und eine CLLocation Variable mit dem lat und lon schaffen in geben.

func mapView(mapView: MKMapView!, regionDidChangeAnimated animated: Bool){ 

    var centre = mapView.centerCoordinate as CLLocationCoordinate2D 

    var getLat: CLLocationDegrees = centre.latitude 
    var getLon: CLLocationDegrees = centre.longitude 


    var getMovedMapCenter: CLLocation = CLLocation(latitude: getLat, longitude: getLon) 

    self.lastLocation = getMovedMapCenter 
    self.fetchCafesAroundLocation(getMovedMapCenter) 

}