[英]Google Place Picker Search Bar text Color not Change iOS Swift
let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
UINavigationBar.appearance().tintColor = UIColor.white
UISearchBar.appearance.textField.setTextColor = UIColor.red
UISearchBar.appearance().barStyle = UIBarStyle.default
self.present(autocompleteController, animated: true, completion:nil)
Try this. 尝试这个。
if #available(iOS 9.0, *) {
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes = [NSForegroundColorAttributeName: UIColor.green]
} else {
// Fallback on earlier versions
}
此版本适用于最新的Swift版本
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.white] as [String:Any]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.