【发布时间】:2018-09-26 14:16:15
【问题描述】:
我尝试使用reverseGeocoordinate 在我的DestinationSearchBar 中显示来自locationEnd 的地址,但我不知道该怎么做。
func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {
let camera = GMSCameraPosition.camera(withLatitude: place.coordinate.latitude, longitude: place.coordinate.longitude, zoom: 15.0)
if locationSelected == .startLocation {
addressSearchBar.text = "\(place.coordinate.latitude), \(place.coordinate.longitude)"
locationStart = CLLocation(latitude: place.coordinate.latitude, longitude: place.coordinate.longitude)
createMarker(titleMarker: "Punto de recojo", iconMarker: #imageLiteral(resourceName: "marker"), latitude: place.coordinate.latitude, longitude: place.coordinate.longitude)
} else {
DestinationSearchBar.text = "\(place.coordinate.latitude), \(place.coordinate.longitude)"
locationEnd = CLLocation(latitude: place.coordinate.latitude, longitude: place.coordinate.longitude)
createMarker(titleMarker: "Punto de destino", iconMarker: #imageLiteral(resourceName: "marker"), latitude: place.coordinate.latitude, longitude: place.coordinate.longitude)
self.mapView.camera = camera
self.dismiss(animated: true, completion: nil)
}
}
【问题讨论】:
-
你能详细说明到底是什么不工作吗?如果有错误,请发布错误消息。如果不是,那么您得到的预期结果和实际结果会更容易回答您的问题。
-
我要改变我提出问题的方式,基本上我想知道的是“怎么做”,我的错误。
标签: ios swift geocoding xcode10