title: How do I remove spaces in UIToolbar between custom views?
body: <p>I'm trying to create a <code>UIToolbar</code> with 5 buttons using custom images. The way I'm doing this is by creating buttons of type <code>UIButtonTypeCustom</code>, then creating <code>UIBarButtonItems</code> from these, then adding these to the toolbar with <code>setItems:animated:</code>. However, this adds spaces between the images which cause the 5th image to end up half off the right side of the toolbar. How do I get rid of these spaces? I've tried everything I can think of.</p>
  
  <p>Help is greatly appreciated.</p>
  
  <p>Here's some example code as to how I'm going about this:</p>
  
  <pre><code>UIButton *button;
  UIBarButtonItem *barButton1,*barButton2;
  
  button = [UIButton buttonWithType:UIButtonTypeCustom];
  [button setImage:[UIImage imageNamed:@"image1.png"] forState:UIControlStateNormal];
  button.bounds = CGRectMake(0,0,button.imageView.image.size.width, button.imageView.image.size.height);
  [button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
  barButton1 = [[UIBarButtonItem alloc] initWithCustomView:button];
  
  
  button = [UIButton buttonWithType:UIButtonTypeCustom];
  [button setImage:[UIImage imageNamed:@"bart_tb.png"] forState:UIControlStateNormal];
  button.bounds = CGRectMake(0,0,button.imageView.image.size.width, button.imageView.image.size.height);
  [button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
  barButton2 = [[UIBarButtonItem alloc] initWithCustomView:button];
  
  NSArray *items = [NSArray arrayWithObjects: barButton1, barButton2, nil];
  [self.toolbar setItems:items animated:NO];
  </code></pre>