google placepicker for ios and BackgroundMapViewController.s



我正在尝试为iOS实现Google的安置。有一些演示代码:

https://github.com/googlemaps/maps-sdk-for-ios-samples/tree/master/googleplacepicker/googleplacepicker/googleplacepickerdemos

我得到了其中的大部分,除了文件pickaplaceviewcontroller.swift

中的行之外
  var mapViewController: BackgroundMapViewController?

在GITHUB回购中,Google提供了自己的类背景mapviewController。

我需要创建此类的实例以使用Place Picker吗?

我可以像通常在Google Maps上一样使用GMSMapView。

谢谢。

对于Google Places Controller,您只需要以下代码即可显示或介绍应用程序中的ploce controller。

将此方法放入UR按钮操作方法中:

// Create a place picker. Attempt to display it as a popover if we are on a device which
    // supports popovers.
    let config = GMSPlacePickerConfig(viewport: nil)
    let placePicker = GMSPlacePickerViewController(config: config)
    placePicker.delegate = self
    placePicker.modalPresentationStyle = .popover
    placePicker.popoverPresentationController?.sourceView = pickAPlaceButton
    placePicker.popoverPresentationController?.sourceRect = pickAPlaceButton.bounds
    // Display the place picker. This will call the delegate methods defined below when the user
    // has made a selection.
    self.present(placePicker, animated: true, completion: nil)

希望这将有助于在您的应用中展示Place Picker。

相关内容

  • 没有找到相关文章

最新更新