Not able to set tintcolor to image set as background in a tableview cell

622 views Asked by At

I am facing trouble setting a tint color to my images which are set as background for my uitableviewcells.

The following is my code:

backgroundImage.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
cell.backgroundView = backgroundImage
cell.backgroundView!.tintColor = UIColor.blackColor()

The images are showing normally without any tint added to them.

Any help is really appreciated.

1

There are 1 answers

0
InkGolem On BEST ANSWER

Replace the first line with this: backgroundImage.image = backgroundImage!.imageWithRenderingMode(.AlwaysTemplate)