有谁知道在 Google 地点选择器中选择地点(除了调用地点选择器的地点之外)后如何转到不同的 View Controller ?
最佳答案
根据谷歌地点选择器documentation
@IBAction func pickPlace(_ sender: UIButton) {
let config = GMSPlacePickerConfig(viewport: nil)
let placePicker = GMSPlacePicker(config: config)
placePicker.pickPlace(callback: { (place, error) -> Void in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let place = place {
DispatchQueue.main.async {
//code to push or present a viewController
}
} else {
print("No place selected")
return
}
print("Place name \(place.name)")
print("Place address \(place.formattedAddress)")
print("Place attributions \(place.attributions)")
})
}
希望这有帮助
关于swift - 在 Google 地点选择器之后更改 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42942363/