我有一个我想要调用的方法,当我回到地图的中心,它是在CLLocationCoordinate2D类型.
如何将CLLocationCoordinate2D的结果放入CLLocation?
解决方法
弄清楚了.
当mapView更改区域时,从CLLocationCoordinate2D获取Lat和Lon,并创建一个带有lat和lon的CLLocation变量.
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)
}