0

I have an imageView in a cell and I can customize the imageTint color. I would like for the imageTint to reflect this gradient behind it, so that that when the user scrolls, the imageTint of the image changes with the background.

Here is what the imageView looks like when I make the tintColor dark.

enter image description here

If I make the imageTint clear, I can't see it because of the white background of the imageView. enter image description here

However, if I make the background of the imageView clear AND the imageTint clear, then nothing shows up at all.

Ideally, I want the end product to look like this: enter image description here

Maybe I'm going about it the wrong way? Maybe I should calculate the gradient colors while the user is scrolling and change them for each individual cell?

Jay Strawn
  • 215
  • 3
  • 14

1 Answers1

0

mostly I use always this

ImageView.image = ImageView.image!.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
ImageView.tintColor = UIColor.redColor() 

// or any color you want

also can you show your code if it need some fixing and what is the image type you are using ?

  • The image is a PNG. I want the black lines to be transparent, but if the imageView.backgroundColor is white, then the imageView background is blocking the black lines, so they can't reflect the gradient colors. – Jay Strawn Apr 04 '20 at 22:37
  • you want to remove the blue background and the black line also ? to make the image clear from all these ? – Ahmad Abdelrahim Apr 04 '20 at 23:10
  • check this answer also https://stackoverflow.com/a/37680479/13175039 – Ahmad Abdelrahim Apr 04 '20 at 23:16