Change UIImage color programmatically

Changing the color of an Icon before iOS 7 was really painful. You had to add an Icon in every single color you wanted to use it. Thanks to iOS 7 this is not necessary any more.

You can not set the specific tint color for the Icon directly to the UIImageView. By choosing either UIImageRenderingModeAlwaysTemplate  when callling the imageWithRenderingMode the Image will be tinted directly in the expected color Рwithout adding a new Icon to the app bundle.

Code snippet

UIImageView *imageView = [UIImageView alloc] init];
[imageView setTintColor:[UIColor blueColor]];
[imageView setImage:[[UIImage imageNamed:@"image"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]];

Feel free to share and comment!