如何自定义 UITableViewCell 的背景颜色? [英] How to customize the background color of a UITableViewCell?

查看:40
本文介绍了如何自定义 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆