title: How to change tintColor of image in UIButton with imageEdgeInsets?
body: <p>I I have an UIButton in my objective-c application. My button was modified adding text and image like:</p>
  
  <pre><code>- (void)centerButtonAndImageWithSpacing:(CGFloat)spacing {
       CGFloat insetAmount = spacing / 2.0;
       self.imageEdgeInsets = UIEdgeInsetsMake(0, -insetAmount, 0, insetAmount);
       self.titleEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, -insetAmount);
       self.contentEdgeInsets = UIEdgeInsetsMake(0, insetAmount, 0, insetAmount);
  }
  </code></pre>
  
  <p>And then I add the image with this code:</p>
  
  <pre><code>[self.myButton setImage:[UIImage imageNamed:@"imageButton.png"] forState:UIControlStateNormal];
  </code></pre>
  
  <p>I want change the tintColor of the image, but when I try change this, my code isn't work:</p>
  
  <pre><code>[self.myButton setTintColor:[UIColor redColor]];
  </code></pre>
  
  <p>I'm trying use this code, but didn't work:</p>
  
  <pre><code>UIImage* img = [UIImage imageNamed:imageName];
  icon.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
  icon.tintColor = [UIColor redColor];
  </code></pre>
  
  <p>I have this:
  <a href="https://i.stack.imgur.com/VVCPQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VVCPQ.png" alt="enter image description here"></a></p>
  
  <p>I want get it:
  <a href="https://i.stack.imgur.com/DYjsj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DYjsj.png" alt="enter image description here"></a></p>
  
  <p>How could I change the color of the imageButton?</p>