17
저는지도의 중심으로 돌아가려면 CLLocationCoordinate2D 유형에 있습니다. 그러나 호출하고 싶은 메소드가 있습니다.CLLocationCoordinate2D를 Swift 용 CLLocation에 넣습니다.
어떻게 CLLocationCoordinate2D의 결과를 CLLocation에 넣을 수 있습니까?
저는지도의 중심으로 돌아가려면 CLLocationCoordinate2D 유형에 있습니다. 그러나 호출하고 싶은 메소드가 있습니다.CLLocationCoordinate2D를 Swift 용 CLLocation에 넣습니다.
어떻게 CLLocationCoordinate2D의 결과를 CLLocation에 넣을 수 있습니까?
알아 냈어.
지도보기 영역이 변경 될 때, CLLocationCoordinate2D의 위도와 경도를 얻을 전달 된 위도 및 경도와 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)
}