我在ios中使用Google自动完成的placekicker。它向我展示了原生设计的控制器。我想自定义它的导航栏colour.But我无法做到。下面是代码
let autocompleteController = GMSAutocompleteViewController()
autocompleteController.tintColor = UIColor.red
autocompleteController.navigationController?.navigationBar.barTintColor = Constant.AppColor.navigationColor
autocompleteController.delegate = self
self.present(autocompleteController, animated: true, completion: nil)
我能够在Swift中自定义一些元素,如下所示:
// Sets the background of results - top line
autocompleteController.primaryTextColor = UIColor.black
// Sets the background of results - second line
autocompleteController.secondaryTextColor = Color.black
// Sets the text color of the text in search field
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.white]