Reputation: 4440
I would like to be able to lower the background alpha of a tableview so it is slightly see through (so I can see the background) but ensure the text and images contained within the cells are kept opaque. One workaround I have used before is that I place a table down, lower the alpha to say 50%, and then add the labels and images on top of the table rather than within the table cells, however this is not a particularly clean solution, particularly if I require the table to scroll, as then the table will scroll but the text/images would not.
Is there anyway I can achieve this without a cheap workaround? Or is the work around I have suggested the only viable solution?
Thanks in advance!
EDIT: Additional info
If anyone is having same problem see here
View with low alpha - Subview with high alpha
Upvotes: 2
Views: 1006
Reputation: 3629
Based on the complexity of your table this may vary, but in your cellForRowAtIndexPath method
You can set background color with transparency:
[cell setBackgroundColor:[UIColor colorWithRed:((float)22 / 255.0f) green:((float)61 / 255.0f) blue:((float)119 / 255.0f) alpha:0.5f]]; //Half transparent
Or you could setup the background view of the cell to an imageview and set the alpha value of that imageview to an alpha value less than 1.
Upvotes: 3