如何自定义UITableViewCell的背景颜色? [英] How to customize the background color of a UITableViewCell?
问题描述
我想自定义我的UITableView中的所有UITableViewCell的背景(也许是边框)。到目前为止,我还没有能够自定义这个东西,所以我有一堆白色背景单元格是默认的。
I would like to customize the background (and maybe the border too) of all of the UITableViewCells within my UITableView. So far I have not been able to customize this stuff, so I have a bunch of white background cells which is the default.
有一种方法来做到这一点iPhone SDK?
Is there a way to do this with the iPhone SDK?
推荐答案
您需要将单元格的contentView的backgroundColor设置为您的颜色。如果您使用配件(例如公开箭头等),它们会显示为白色,因此您可能需要滚动这些配件的自定义版本。
You need to set the backgroundColor of the cell's contentView to your color. If you use accessories (such as disclosure arrows, etc), they'll show up as white, so you may need to roll custom versions of those.
这篇关于如何自定义UITableViewCell的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!