I have a UISearchBar
contained within a UIView
and the UIView
has been assigned to a UITableView's tableHeaderView.
I'm trying to style the UISearchBar
to look like this:
Out of the gate, this is what it looks like:
There are loads of SO questions and answers on how to style UISearchBar
, its search field, etc., some with particular attention to backgrounds. Many of them involve traversing the UISearchBar's subviews
, finding a UISearchBarBackground
(or _UISearchBarSearchFieldBackgroundView
) object, and setting its background color directly. I'm trying to find a supported API for doing this, however...
The setSearchFieldBackgroundImage:forState:
method seems to have great potential, but this is what I get when I use a 1px white (or transparent) image using UIControlStateNormal
:
Any ideas as to how to get this to work? I'd appreciate someone pointing me to a SO post that answers this, but I really do think I've read them all. Thanks a ton.