0
votes

I'm experiencing that table view cells no longer obey the alpha value that is passed to them upon setting the color property in iOS10. I began to see this in the beta but was hoping that it would be fixed and my post on the apple dev forums has been ignored. For example the color code below no longer works when I assign it to a table view cell (it worked until now).

define TABLE_50_RED [UIColor colorWithRed:128.0 green:0 blue:0.0 alpha:0.3]
.
.
.
cell.backgroundColor = TABLE_50_RED;

I can set the alpha on the entire cell but that also does the text as well - and is not desired. Setting the alpha on the text color to 1.0 also doesn't counteract the alpha of the cell.

Anyone else experiencing this issue?

Any suggestions?

Thanks

1
Read the docs for UIColor colorWithRed:green:blue:alpha:. Note the valid range for each value.rmaddy
They are all valid ranges thanks. The documentation states the values should be between 0.0 and 1.0. The documentation DOES also state "On applications linked for iOS 10 or later, the color is specified in an extended range sRGB color space. " had you said this to begin with I would have actually thought you were trying to answer instead of giving me a slightly nicer RTFM. Thanks!alexpwalsh
Hi there: have you tried using the UIColor.colorWithAlphaComponent function? Without knowing more about your situation I can't flag this as a definite answer. Could you expand a bit on how you've set the alpha for the cell and the containing views up the hierarchy?Marcus
I have. There's not really much more to say. It is a table view with cells added to it. If I use the same color/opacity values as settings in the storyline it works. The documentation says that in iOS10 colors use sRGB space but I have no idea what I have to do to change this (as the documentation is poor), or know if I even have to do anything at all for the change. The views up the hierarchy haven't been touched as far as I am aware. I will investigate and report.alexpwalsh

1 Answers

1
votes

Although rmdaddy was correct - I didn't like his answer. The answer was as he stated an issue with the parameters but I couldn't see the forest for the trees. I had 128 in the red value and it should have been 0.5 (128/256) which could have very simply been resolved had he pointed that out specifically. There's no such thing as a stupid question - only stupid answers.