gpt4 book ai didi

iphone - 设置自定义表格 View 单元格的背景图像

转载 作者:行者123 更新时间:2023-12-03 20:17:45 25 4
gpt4 key购买 nike

我尝试了多种方法来设置未选定的表格单元格的背景图像,但没有成功:

1- In IB setting the image field
2- cell.contentView.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"list.png"]];
3- cell.imageView.image = [UIImage imageNamed:@"list_selected.png"];

一切似乎都失败了。选定单元格的图像设置有效,但不适用于未选定的单元格。有人知道这里可能出了什么问题吗?

谢谢

最佳答案

尝试将backgroundView设置为图像的imageView。

Jason Moore 的代码示例(经过 TomH 的修正):

cell.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"foo.png"]] autorelease];

关于iphone - 设置自定义表格 View 单元格的背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2271274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com