Apply UIColor to UIImage

suggest change

Reuse one template image across themes by tinting the view that displays it.

// Create a template image. The view's tintColor supplies the color.
UIImage *imgMenu = [[UIImage imageNamed:@"iconMenu"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[btn setImage:imgMenu forState:UIControlStateNormal]; // Set UIImage in UIButton.

[button.imageView setTintColor:[UIColor blueColor]]; // It changes image color of UIButton to blue color

To do the same with a UIImageView:

[imageView setImage:imgMenu]; // Assign UIImage to UIImageView
[imageView setTintColor:[UIColor greenColor]]; // Change imageview image color to green.
[imageView setTintColor:[UIColor redColor]]; // Change imageview image color to red.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents