title: UIBarButtonItem image (or UIToolbar custom background image?..) is darker (or lighter?..) than original
body: <p>I want to create custom buttons for UIToolbar (and a custom background color for UIToolbar) in XCode. </p>
  
  <p>So far, I've done it like this: create UIButton, then set an image to it and then drag it to UIToolbar. It becomes UIBarButtonItem after this, but still it has an image so it's fine for me.  </p>
  
  <p>The problem is, that for some reason buttons' images became darker than original images (I can see it because my toolbar background is exactly the same as buttons' background), but when I press the button, I see that its image becomes original-like and then after a sec turns back to the darker one. </p>
  
  <p>I've tried to do as said in this question: <a href="https://stackoverflow.com/questions/10474536/image-in-uibutton-is-darker-tharn-original">Image in UIButton is darker tharn original</a>, setting highlighted image in XCode, but after this it stopped 'changing to original' at all. </p>
  
  <p>So, how can I solve this? I don't really want to bring some GUI stuff like this in code if there's a way to do this by XCode... Any help would be appreciated. </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>That's the screen shot of what's going on:</p>
  
  <p><img src="https://i.stack.imgur.com/gpQ1K.png" alt="The screenshot of toolbar and bar item"></p>
  
  <p>And that's how they should look like with toolbar background + buttom image combined:</p>
  
  <p><img src="https://i.stack.imgur.com/k6scK.png" alt="enter image description here"></p>
  
  <p>Now I did it in code like this:</p>
  
  <pre><code>@implementation UIBarButtonItem (CustomView)
  + (UIBarButtonItem*) barItemWithImage:(UIImage *)image target:(id)target action:(SEL)action
  {    
      UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
      button.bounds = CGRectMake(0, 0, image.size.width, image.size.height);
      [button setImage:image forState:UIControlStateNormal];
      [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
  
      UIBarButtonItem* item = [[self alloc] initWithCustomView:button];
      return item;
  }
  @end
  </code></pre>
  
  <p>And the calling code:</p>
  
  <pre><code>UIBarButtonItem *item =[UIBarButtonItem barItemWithImage:[UIImage imageNamed:@"settings"] target:nil action:nil];
  [self.bottomBar setItems:@[item]];
  </code></pre>
  
  <p>For toolbar background I use this code:</p>
  
  <pre><code>[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"toolbar_background"]
                          forToolbarPosition:UIToolbarPositionAny
                                  barMetrics:UIBarMetricsDefault];
  </code></pre>
  
  <p>The problem remains the same...</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Wow, it seems like actually the UIToolbar is lighter than original...</p>
  
  <p><strong>EDIT 3:</strong></p>
  
  <p>Well. Created new project and tested the XCode storyboard-way (with UIButton), there is works fine... That's a mystery for me, totally lost here. Need some serious clarification here about possible reasons of this: my current project is huge and I'm not able to post all the code here...</p>