简体   繁体   English

自定义表格单元格背景图像

[英]Custom table cell background image

I'm taking my first stab at the three20 iPhone framework and I can't seem to figure out how to change the background of a table cell to a UIImage instead of just the color. 我正在第三次尝试使用iPhone20框架,我似乎无法弄清楚如何将表格单元格的背景更改为UIImage而不仅仅是颜色。 Can anyone help me out? 谁能帮我吗?

You can set the backgroundColor of the cell's contentView with an image pattern like this: 您可以使用如下图像模式设置单元格contentViewbackgroundColor

cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]];

This will work if the cell is a UITableViewCell or a three20 TTTableViewCell derivative (since they derive from UITableViewCell ) 如果单元格是UITableViewCell或者是TTTableViewCell衍生物(因为它们派生自UITableViewCell ),这将有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM