title: Placing a custom view based UIBarButtonItem in the navigation bar without default horizontal padding
body: <p>How do I remove the horizontal padding to the left and right of custom left and right UINavigationBar items? There seems to be ~ 10 points of padding that iOS sets by default.</p>
  
  <p>I'm customizing left and right navigation bar buttons (I have given up on trying to set my own backButtonItem, so I'm just using the leftBarButtonItem).</p>
  
  <p>In either case (left or right), pressing these custom buttons indicates that Apple seems to preserve some padding to the left of the leftBarButtonItem, and to the right of the rightBarButtonItem; regardless of how wide I make the custom background and image properties of the UIButton I place inside the left/right bar button item as its custom view.</p>
  
  <p>Since UIBarButtonItems have no "frame" I can access, I can't position them within their superview like I can normal UIViews.</p>
  
  <p>Any suggestions on how to remove this default padding? See screen shot attached to see the bit I'm trying to reduce to a zero width. In the screen shot, the plus icon appears shifted to the right because I gave it an inset; but the highlighted background image, also presumably using that inset, is getting clipped on its right side).</p>
  
  <p>See image at: <a href="https://skitch.com/starbaseweb/rj2e5/ios-simulator">https://skitch.com/starbaseweb/rj2e5/ios-simulator</a></p>
  
  <p>For reference, here's how I'm creating my custom UIBarButtonItem (in this case, it's the right button):</p>
  
  <pre><code>- (UIBarButtonItem *)customAddButtonItemWithTarget:(id)target action:(SEL)action {
    UIButton *customButtonView = [UIButton buttonWithType:UIButtonTypeCustom];
  
      customButtonView.frame = CGRectMake(0.0f, 0.0f, 45.0f, 44.0f);
  
      [customButtonView setBackgroundImage:
          [UIImage imageNamed:@"bgNavBarButton-OutsideRight-Normal.png"] 
          forState:UIControlStateNormal];
      [customButtonView setBackgroundImage:
          [UIImage imageNamed:@"bgNavBarButton-OutsideRight-Highlighted.png"] 
          forState:UIControlStateHighlighted];
  
      [customButtonView setImage:
          [UIImage imageNamed:@"bgNavBarButton-Add-Normal.png"] 
          forState:UIControlStateNormal];
      [customButtonView setImage:
          [UIImage imageNamed:@"bgNavBarButton-Add-Highlighted.png"] 
          forState:UIControlStateHighlighted];
  
      [customButtonView addTarget:target action:action 
          forControlEvents:UIControlEventTouchUpInside];
  
      UIBarButtonItem *customButtonItem = [[[UIBarButtonItem alloc] 
          initWithCustomView:customButtonView] autorelease];
      [customButtonView setImageEdgeInsets:UIEdgeInsetsMake(0.0f, 10.0f, 0.0f, 0.0f)];
  
      //customButtonItem.imageInsets = UIEdgeInsetsMake(0.0f, 10.0f, 0.0f, 0.0f);
  
      return customButtonItem;    
  }
  </code></pre>