iOS倒塌tableviewcell是透明的 - iOS collapsed TableViewCells are transparent

- 此内容更新于:2016-01-20
主题:

我想实现TableView与可扩展的细胞。我选择当一个细胞改变细胞的高度显示其他内容。问题是,当细胞倒塌时,他们是透明的,所有的内容都是通过降低细胞可见。我怎么能让这些细胞不透明?

原文:

I'm trying to implement a TableView with expandable cells. When a cell is selected I change the height of the cell to show the rest of the content. The problem is that when the cells are collapsed, they are transparent and all of the content is visible through the lower cells. How can I make these cells opaque?

网友:单元格背景颜色设置为clearColor

(原文:set cell background color as clearColor)

解决方案:
如果我理解你的问题,不是细胞是透明的,它的子视图可见范围以外的细胞。你可以消除对你的细胞,通过设置clipsToBounds房地产是的。你可以在代码中,或者在IB通过选择“剪辑子视图”复选框。
原文:

If I understand your problem, it's not that the cell is transparent, it's that the subviews are visible outside the bounds of the cell. You can eliminate that by setting the clipsToBounds property for your cell to YES. You can do that in code, or in IB by selecting the "Clip Subviews" checkbox.

楼主:谢谢你们!就是这样!

(原文:Thank you! That did it!)