I'm trying to exactly recreate the appearance of the default UISearchBar with UIAppearance. The problem is, when I try and get the value of the variables in the title, they are nil.
I've tried [[UISearchBar appearance] barTintColor]
and self.searchBar.barTintColor
but to no avail.
I used the DigitalColor Meter in the Utilities folder to get the value of the bar normally, then set the background to white and set the barTintColor
to the measured value. This almost worked, but the 'cancel' button blended in and dark lines appeared on the top and bottom of the search bar.
So I either need the default values for the two colours or a way to read said default values.
Given nobody has answered and this post is high up in relevant google search results, I'd like to give the answer that finally fixed it for me.
Simply setting the colour to nil
works in making them use their default values.