简体   繁体   中英

GMSAutocompleteViewController iOS, How to change placeholder color & Cancel button color in searchControllers?

I'm using a GMSAutocompleteViewController but the placeholder and Cancel button is not appearing clearly. For this I want to change the placeholder color and the cancel button color. How can I do that. Please help me out. 在此处输入图像描述

UINavigationBar.appearance().tintColor = .white // cancel button
    
    
    UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).attributedPlaceholder = NSAttributedString(
      string: "Search",
      attributes: [NSAttributedString.Key.foregroundColor: UIColor(hexString: "#4B4B4C").withAlphaComponent(0.8)]
  ) // placeholder
    
    UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).tintColor = .gray // cursor color
    

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM