Google Maps Place Picker iOS Swift

I am implementing the Google Maps map collector in Swift. The placement tool provided by google automatically displays a view controller with a navigation bar. When I select a location or click the "Back" button on the navigation bar, the view controller immediately disappears without any transition. It seems I can’t access the navigation bar through the location selection API. How can I reject the viewpicker view controller with animation or maybe access the navigation bar? I'm at a loss. When I press the button, my code raises the place of choice,

    @IBAction func pickPlace(sender: UIButton) {
    if let mapView = self.mapView {

        let visibleRegion = mapView.projection.visibleRegion()
        let viewport = GMSCoordinateBounds(coordinate: visibleRegion.farLeft, coordinate: visibleRegion.nearRight)
        let config = GMSPlacePickerConfig(viewport: viewport)
        placePicker = GMSPlacePicker(config: config)
        placePicker.pickPlaceWithCallback { (place: GMSPlace?, error: NSError?) -> Void in
            if error != nil {
                println("Error picking place: \(error!.localizedDescription)")
                return
            }
            if place != nil {
                self.userLocationTextField.text = place!.name
                println("Place name \(place!.name)")
                println("Place address \(place!.formattedAddress)")
                println("Place attributions \(place!.attributions)")


                let marker = GMSMarker(position: place!.coordinate)
            } else {
                println("No place selected")
            }
        }
    }

The only way to access the location selection view controller is with the following code:

    let topVC = UIApplication.sharedApplication().keyWindow?.rootViewController

.

+4
1

, .

UINavigationBar.appearance().barTintColor = YOURCOLOR
UINavigationBar.appearance().isTranslucent = false
0

All Articles