[英]how to set background color + opacity in table view cell + style is grouped
i have one tableview
with style grouped.我有一个分组样式的
tableview
。 in this i set background color clearcolor
在这个我设置背景颜色
clearcolor
like this , cell.backgroundColor =[UIColor blackColor];
像这样,
cell.backgroundColor =[UIColor blackColor];
now i want this cell transparent.现在我想要这个单元格透明。 may be i can do this with opacity.
也许我可以用不透明度来做到这一点。 but in this how can i set opacity.
但在这我如何设置不透明度。
i want same like this for cell background >>我想要这样的单元格背景 >>
here opacity .这里不透明度。 how can i do same this by coding in cell background ?
我如何通过在单元格背景中编码来做到这一点?
You can use cell.alpha = 0;
您可以使用
cell.alpha = 0;
then your cell is invisible but all textLabels etc. to.那么你的单元格是不可见的,但所有的 textLabels 等等。
If you want only the cell.backgroundColor a bit transparent you can use如果你只想要 cell.backgroundColor 有点透明,你可以使用
cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.]
Apart from the above answer.除了上面的答案。 You can achieve transparency by simply setting cell's contentView alpha.
您可以通过简单地设置单元格的 contentView alpha 来实现透明度。
cell.backgroundColor = .black
cell.contentView.alpha = 0.5
//. //. Add this to viewdidload()
将此添加到 viewdidload()
tableView.backgroundColor = UIColor.black
tableView.alpha = 0.65
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.