简体   繁体   English

iPhone:如何设置表格背景图片

[英]iphone:how to set table background Image

I tried that as 1st took image view as background of table view and select the image.then i perform the following code in view will appear: 我尝试作为第一个将图像视图作为表格视图的背景并选择图像。然后我将在视图中执行以下代码:

  table.backgroundColor = [UIColor clearColor];

and also clear the custom cell label.but it overlaps the table values. 并清除自定义单元格标签。但是它与表格值重叠。

This works for me 这对我有用

UIImageView *tempImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[tempImg setImage:[UIImage imageNamed:@"IMG_0071.JPG"]];
[testTableView setBackgroundView:tempImg];

you need to use transparent UITableView on the UIImageView. 您需要在UIImageView上使用透明的UITableView。 Put your image into the image view and it looks like table's background image as you want 将您的图像放入图像视图中,即可根据需要看起来像表格的背景图像

you might wanna try putting UIImage behind UITableView.. Use method insertView:atIndex: on a view. 您可能想尝试将UIImage放在UITableView后面。在视图上使用方法insertView:atIndex:

also.. you might wanna look at this tutorial by Matt Gallagher http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html 另外,您可能想看一下Matt Gallagher 撰写的本教程http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

You have to clear tableviewcell background color. 您必须清除tableviewcell背景色。 You have to write this code before return cell; 您必须在return cell;之前编写此代码return cell; statement. 声明。

cell.backgroundColor = [UIColor clearColor];

And also table cell label color. 以及表格单元格标签的颜色。

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

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