0

有谁知道在谷歌地点选择器中选择一个地点后如何转到另一个视图控制器,而不是调用地点选择器的那个?

4

1 回答 1

0

根据谷歌地点选择器文档

@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)")
  })
}

希望这可以帮助

于 2017-03-22T04:40:59.457 回答