我有一个我想调用的方法,但是当我回到地图的中心时,它是CLLocationCoordinate2D类型的。
如何将CLLocationCoordinate2D的结果放到CLLocation中?
发布于 2014-11-12 02:23:51
我想通了。
当mapView更改区域时,从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)
}
https://stackoverflow.com/questions/26871750
复制相似问题