0

Trying to get the left most image icon within the search bar to change color for Dark Mode in iOS 13

Ive tried making a call directly to the searchBar and changing its background color, changing the text color, and finally I've tried a couple different iterations of the code below.

        searchBar.backgroundColor = .clear
        searchBar.backgroundImage = UIImage(named: "magnifyingglass")
        if #available(iOS 13, *) {
            searchBar.textField?.attributedPlaceholder = 
    NSAttributedString(string: (" " + NSLocalizedString("search_actions", comment: "")), 
    attributes: [NSAttributedString.Key.foregroundColor: UIColor.separator, 
    NSAttributedString.Key.strokeColor: UIColor.separator])
            
        }
2
  • What the question? Why only iOS 13? Commented Aug 12, 2022 at 21:09
  • 1
    iOS 13 or newer, because iOS 13 is when dark mode was released @meaning-matters Commented Aug 15, 2022 at 13:17

0

Browse other questions tagged or ask your own question.