回答
不要ü想设置背景图片为您的表或在UITableView的 单个细胞如果是用于设置背景图片,然后执行以下操作:
UIImage *bgImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"background.png" ofType:nil]];
UIColor *bgColor = [[UIColor alloc] initWithPatternImage:bgImage]; self.view.backgroundColor = bgColor;
[tableName setBackgroundColor:[UIColor clearColor]];
其中tablename是你的UITableView的名称
如果你想设置背景图片的UITableView单元格,然后执行以下操作:
cell.backgroundColor = [UIColor clearColor];
UIImageView *cellBG_tap = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image.png" ofType:nil]]];
cell.backgroundView = cellBG_tap;
[cellBG_tap release];
设置在小区的一类,然后用CSS把背景图像,如下图所示:
<table class="myTable">
<tr>
<td class="myCell"></td>
</tr>
</table>
<style>
.myCell {
background: url(my_image.gif)
}
</style>
很确定@kiran意味着使用UITableViewCell而不是网页。 – Jordan 2010-10-19 06:47:57
这个问题在“iPhone”下标记,而不是HTML或CSS。 – 2010-10-19 06:48:09
我的不好。应该更仔细地红色。 – 2010-10-19 06:48:47
一种方法是修改的UITableViewCell的内容查看。例如:
//Add custom objects to the cell in here!
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.jpg"]];
imageView.center = CGPointMake(310, 48);
[cell.contentView addSubview:imageView];
[email protected]"test";
设定背景图片
UIImageView* img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"yourImage.png"]];
[cell setBackgroundView:img];
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
cell.textLabel.font =[UIFont systemFontOfSize:20.0];
cell.detailTextLabel.textColor=[UIColor whiteColor];
cell.detailTextLabel.font = [UIFont systemFontOfSize:15.0];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.imageView.image = [UIImage imageNamed:@"Square.gif"];
}
在表视图数据源
cellForRowAtIndexPath
if (indexPath.row%2==0) {
UIImageView *img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"image..."]];
cell.backgroundView=img;
[img release];
我用这它的工作
.... @all感谢人们贡献自己的知识
- 1. 在桌面背景上只显示桌面背景上的winform
- 2. 如何将桌面背景图像保存到c#文件中?
- 3. 桌面视图钛的背景图像
- 4. 如何将视频显示为桌面背景(在XP中)?
- 5. 背景图像不显示的面板
- 6. 如何显示的图像为背景
- 7. 不显示背景图像
- 8. 背景图像不显示
- 9. Matlab - 显示背景图像
- 10. 背景图像不显示
- 11. 不显示背景图像
- 12. 背景图像显示
- 13. 不显示背景图像
- 14. 背景图像dosnt显示
- 15. 不显示背景图像
- 16. 将不会显示CSS背景图像
- 17. 图像与背景图像不显示
- 18. 如何显示桌面背景变暗的窗体?
- 19. 如何设置多个桌面背景(双显示器)
- 20. CSS:在子背景图像上显示父级背景图像
- 21. 滚动背景,直到整个背景图像显示
- 22. JavaFX显示器场景背景图像
- 23. 如何将背景图像添加到平面图?
- 24. 如何使用angular1将图像显示在正面/背面?
- 25. 将图像带到背景
- 26. 在python 2.7透明背景窗口在桌面上显示图像
- 27. 如何将.gif作为背景图像显示?
- 28. 将用作启动图像fullscreend的图像显示为背景
- 29. 将背景图像添加到现有的背景图像
- 30. 如何显示备用图像,如果背景图像没有找到
在设置单元格的backgroundColor前设置cell.backgroundColor = [UIColor clearColor] – Swapna 2010-10-19 11:07:44
@ swapna谢谢 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath :(NSIndexPath *)indexPath {cell_textLabel.font = [UIFont systemFontOfSize:20.0]; \t cell.detailTextLabel.textColor = [UIColor whiteColor]; \t cell.detailTextLabel.font = [UIFont systemFontOfSize:15.0]; \t cell.textLabel.backgroundColor = [UIColor clearColor]; \t cell.detailTextLabel.backgroundColor = [UIColor clearColor]; \t cell.imageView.image = [UIImage imageNamed:@“Sapphire Square.gif”]; } - 用于以上代码工作。谢谢所有 – 2010-10-19 12:22:01