我试图在Swift4上的GooglePlacePicker中自定义NavigationController,但是没有按照我想要的方式工作。
有没有人知道如何在Swift4上的placePicker中更改导航UI? 谢谢您阅读此篇!
@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
}
答案 0 :(得分:1)
试试这个
placePicker.navigationController?.navigationBar.barTintColor = UIColor.black
placePicker.navigationController?.navigationBar.isTranslucent = false
答案 1 :(得分:0)
尝试使用外观代理它肯定会改变所有的导航栏以及GMSPlacePickerViewController导航栏。对我来说它就像这样工作
UINavigationBar.appearance().barTintColor = UIColor.black
UINavigationBar.appearance().isTranslucent = false