Upgraded from Xcode 5 to 6 and now my search bar tint is black.
Tried to change it through storyboard right pane > "Bar Tint" to clear color, but it's still black.
Also tried programmatically:
[self.searchBar setTintColor:[UIColor clearColor]];
Still black :(
Any ideas?
I've been seeing this problem as well on iOS8 / XCode 6. I did not get the search bar translucent. searchbar.barTintColor or searchbar.tintColor setting to clear color did not help or shows a black searchbar.
The only workaround i found was to set a translucent background png image (alpha=0.0) and setting searchbar.barTintColor to clear color.
I got to change it on iOS 9 using Swift 2.0 this way:
On Swift 3:
Setting up the background of the searchBar to an empty image:
The
tintColor
property on search bars, much like UINavigationBar, changes the color of the buttons, as well as changes the color of the blinking cursor, not the actual search bar background. What you want to use is thebarTintColor
property.Produces the following ugly, yet informative, result:
If you want to have a completely transparent search bar, you need to set the background image as well:
EDIT: I would strongly advise against traversing and modifying the subviews of any UIKit object, as has been proposed in other answers. From Apple's documentation:
https://developer.apple.com/documentation/uikit/uiview/1622614-subviews