title: Changing UISearchBar search field background
body: <p>I have a <code>UISearchBar</code> contained within a <code>UIView</code> and the <code>UIView</code> has been assigned to a <code>UITableView's tableHeaderView.</code> I'm trying to style the <code>UISearchBar</code> to look like this:</p>
  
  <p><img src="https://i.imgur.com/Yij5mg4.png" alt="What I want"></p>
  
  <p>Out of the gate, this is what it looks like:</p>
  
  <p><img src="https://i.imgur.com/AyNxaAp.png" alt="How it looks now"></p>
  
  <p>There are loads of SO questions and answers on how to style <code>UISearchBar</code>, its search field, etc., some with particular attention to backgrounds. Many of them involve traversing the <code>UISearchBar's subviews</code>, finding a <code>UISearchBarBackground</code> (or <code>_UISearchBarSearchFieldBackgroundView</code>) object, and setting its background color directly. I'm trying to find a supported API for doing this, however...</p>
  
  <p>The <code>setSearchFieldBackgroundImage:forState:</code> method seems to have great potential, but this is what I get when I use a 1px white (or transparent) image using <code>UIControlStateNormal</code>:</p>
  
  <p><img src="https://i.imgur.com/QHr98IO.png" alt="Using a transparent image for setSearchFieldBackgroundImage:forState:"></p>
  
  <p>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.</p>