2014-11-11 14 views

risposta

32

Capito.

Quando MapView cambia regione, ottenere il Lat e Lon da CLLocationCoordinate2D e creare una variabile CLLocation con la lon lat e passato in.

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) 

} 
Problemi correlati