title: UIImage resizableImageWithCapInsets: not working as expected
body: <p>I'm writing my first iOS app targeting the iOS 5.0+ platform. I'm using the <code>UIAppearance</code> protocol to customize the applications UI.</p>
  
  <p>I'm trying to change the backgrounds for <code>UIBarButtonItem</code> across the entire application. Due to the fact that my <code>UIBarButtonItem</code>'s may change size depending on the text or icon used I'm trying to utilize <code>UIImage resizableImageWithCapInsets:</code> with my background png.</p>
  
  <p>I originally found the code I needed on <a href="http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5" rel="noreferrer">Ray Wenderlich</a>. Using the same exact code, with an image that's pretty close to the one used in the aforementioned tutorial, I'm getting weird results. Maybe it's just my inexperience with Cocoa Touch.</p>
  
  <p>Here is the code I'm using.</p>
  
  <p><strong>DreamsAppDelegate.m - customizeAppearance:</strong></p>
  
  <pre><code>UIImage *btnBg = [[UIImage imageNamed:@"navBarButton-bg"] 
            resizableImageWithCapInsets:UIEdgeInsetsMake(0, 6, 0, 6)];
  
  [[UIBarButtonItem appearance] setBackgroundImage:btnBg 
                                          forState:UIControlStateNormal 
                                        barMetrics:UIBarMetricsDefault];
  </code></pre>
  
  <p>Here is the png background image I'm trying to use</p>
  
  <p><img src="https://i.stack.imgur.com/qEkpz.png" alt="png background"></p>
  
  <p>And here is the result (in the simulator)</p>
  
  <p><img src="https://i.stack.imgur.com/TlGfi.png" alt="result of trying to use resizableImageWithCapInsets:"></p>