tintColor property of UIImageview ignore for animating images

Originator:alexandre.perez92
Number:rdar://23517334 Date Originated:12-Nov-2015 08:59 AM
Status:Duplicate of 15436883 (Open) Resolved:
Product:iOS SDK Product Version:9.1
Classification:UI Reproducible:Always
 
MARKED AS: Duplicate of 15436883 (Open)

Summary:
Since iOS 7, we can use tintColor in UIView subclass to easily render a view for a certain tint color. It's a huge time saver when reusing images in different application.
To set the color of an image in a image view, the image need to have the property renderingMode equal to UIImageRenderingModeAlwaysTemplate. Then you set the image to an UIImageView and set the wanted tintColor to the imageView. This work, and paint the image's non-transparent parts according to the UIImageview's tintColor.

But this is not working when we use an animated images instead of a single image. (see the three examples in the sample app provide). In this case, the animation is performed correctly but the images use their original color instead of the UIImageView's tintColor.

Steps to Reproduce:
Run the attached sample project

Expected Results:
Animated UIImageView with the provided images painted according to the UIImageView's tintColor.

Actual Results:
Animated UIImageView with the provided images, but the images use their original color.

Version:
iOS 9.1

Notes:


Configuration:
iPhone 6

Attachments:
'playground.zip' was successfully uploaded.

Comments

Content of the playground project (the important part)

Create a sample project, add 4 images in a xcassets, set the image "render as" to "template image" and add the following code in the viewDidLoad.

`{ UIImage *images = [UIImage animatedImageNamed:@"play_" duration:1.0]; NSLog(@"%ld", (long)images.renderingMode);

    UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    iv.image = images;
    iv.tintColor = [UIColor greenColor];

    [self.view addSubview:iv];
}

{
    UIImage *images = [UIImage animatedImageWithImages:@[
                                                         [UIImage imageNamed:@"play_1"],
                                                         [UIImage imageNamed:@"play_2"],
                                                         [UIImage imageNamed:@"play_3"],
                                                         [UIImage imageNamed:@"play_4"]
                                                         ] duration:1.0];
    NSLog(@"%ld", (long)images.renderingMode);

    UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(100, 250, 100, 100)];
    iv.image = images;
    iv.tintColor = [UIColor greenColor];

    [self.view addSubview:iv];
}

{
    UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(100, 400, 100, 100)];
    iv.animationImages = @[
                           [UIImage imageNamed:@"play_1"],
                           [UIImage imageNamed:@"play_2"],
                           [UIImage imageNamed:@"play_3"],
                           [UIImage imageNamed:@"play_4"]
                           ];
    iv.animationDuration = 1.0;
    iv.tintColor = [UIColor greenColor];
    [iv startAnimating];

    [self.view addSubview:iv];
}```
By alexandre.perez92 at Nov. 12, 2015, 5:04 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!