How to customize navigationbar in GooglePlacePicker on Swift4?

398 views Asked by At

I'd have tried to customize NavigationController in GooglePlacePicker on Swift4, but there is not working what I want.

Does anyone know how to change navigation UI in placePicker on Swift4? Thank you for reading this!

@IBAction func pickPlaceBtn(_ sender: Any) {

    let config:GMSPlacePickerConfig = GMSPlacePickerConfig(viewport: nil)
    print(config.viewport)
    let placePicker:GMSPlacePickerViewController = GMSPlacePickerViewController(config: config)

    placePicker.delegate = self
    present(placePicker, animated: true, completion: nil)

    //Does not work.
    placePicker.navigationController?.navigationBar.backgroundColor = UIColor.black

}

enter image description here

2

There are 2 answers

0
Rajeev Udayan On

try this

placePicker.navigationController?.navigationBar.barTintColor = UIColor.black
placePicker.navigationController?.navigationBar.isTranslucent = false
0
Waseem05 On

Try to use appearance proxy it will definitely change all of the navigation bars along with GMSPlacePickerViewController navigation bar.For me it worked like this

UINavigationBar.appearance().barTintColor = UIColor.black
UINavigationBar.appearance().isTranslucent = false