Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rendering mode set to Template for vector pdf in image catalogue, but UIImageView wont tint the image in a custom cell

I have migrated all my image files to the asset catalogue. All of them are pdf vectors of size 1x. They are set to render as a Template. They show up fine everywhere in size and in color. But there is this one custom TableView Cell from a xib that I has 6 UIImageView s linking to 6 of these images from the catalogue. Somehow they don't respect the tint color, neither default nor custom. Tried changing them programmatically but didn't work either. These same images show up fine in another tableview with static cells inside the main storyboard. I am not able to isolate the issue. Interestingly, the tint shows up perfectly fine once the cell is selected and the selection is changed. Then it tends to show the tint as set in IB. Seems to be like a bug to me in xcode. The problem exists in both, simulator and device. Any help?

PS: Already searched StackOverflow and the answers are all to change the rendering mode to template, which it is that way already.

Image Catalogue

Image Catalogue

Storyboard

Storyboard

Image before selection

enter image description here

image after selection

enter image description here

like image 232
AceN Avatar asked Mar 18 '15 06:03

AceN


1 Answers

Template image is work for something like UIButton.image but not UIImageView.image .

You have to set UIImage AlwaysTemplate by yourself.

imageView.image = [[UIImage imageNamed:@"image"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

And set rendering mode in imageAssets is not working in iOS 7.

like image 83
PowHu Avatar answered Oct 24 '22 00:10

PowHu