2017-09-04 3 views
0

私はiosのgoogleのplacepickerを実装しようとしています。 そこにいくつかのデモコードです:iosとBackgroundMapViewController.swiftのgoogle placepicker

https://github.com/googlemaps/maps-sdk-for-ios-samples/tree/master/GooglePlacePicker/GooglePlacePickerDemos

は、私は自分のクラスBackgroundMapViewControllerを提供しているGoogleのレポgithubのにはファイルPickAPlaceViewController.swift

var mapViewController: BackgroundMapViewController? 

の行を除いて、それのほとんどを得ます。

プレイスピッカーを使用するには、このクラスのインスタンスを作成する必要がありますか?

通常、Googleマップと同じようにGMSMapViewを使用できますか?

ありがとうございました。

+0

ここから地図を選んでください。はいの場合は、既にプロジェクトでGMSPlacePickerViewControllerを作成して使用します。 – CodeChanger

+0

こんにちはCodeChanger。私はあなたが何を言おうとしているのか本当に理解していませんでした。それを明確にしていただけますか?どうも。 – Mike

+0

プレイスピッカーの回答を確認してください。 – CodeChanger

答えて

0

Googleプレイスコントローラの場合、プレースコントローラをアプリに表示するには次のコードが必要です。この意志はあなたのアプリケーションに入れピッカーを表示するのに役立ちます

// 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) 

希望:

はウルボタンアクションメソッドでこれを入れてください。

関連する問題