GooglePlacesPicker 1.2

GooglePlacesPicker 1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2017年1月
SwiftSwift 版本3.0
SPM支持 SPM

Ihor Rapalyuk 维护。



  • LETZGRO

GooglePlacesPicker

Swift iOS Pod。GooglePlacesPicker 允许用户选择 Google 地点。

导入

    import GooglePlacesPicker

Cocoapods

    pod 'GooglePlacesPicker'

1) 您需要像这样设置您的 API 密钥

    GooglePlaces.googlePlacesAPIKey = "[KEY]"

2) 实现您需要的 GooglePlacePickerViewControllerDelegate 方法

    func googlePlacePicker(googlePlacePickerViewController: GooglePlacePickerViewController, didSelectGooglePlace googlePlace: GooglePlace)

    func googlePlacePickerViewControllerDidPressCancelButton(googlePlacePickerViewController: GooglePlacePickerViewController)

3) 显示 GooglePlacesPicker

    let alert = GooglePlacePickerViewController()
    alert.delegate = self
    self.presentViewController(alert, animated: true, completion: nil)

alt text

要自定义选择器,简单地从 GooglePlacePickerViewController 继承并重写 updateUI 方法,如下所示

    import GooglePlacesPicker
    class TestGooglePlacePickerViewController: GooglePlacePickerViewController {

        override func updateUI() {
            super.updateUI()
            self.leftBarButtonItem?.tintColor = UIColor.blackColor()
            self.rightBarButtonItem?.tintColor = UIColor.blackColor()
            self.navigationBar?.barTintColor = UIColor.redColor()
        }
    }

示例项目 https://github.com/letzgro/GooglePlacesPicker/tree/master/GooglePlacesPickerExample