2013-02-25 66 views
0

我正在设置UITableView分组图像,但它显示了整个表我想它应该在第二个表中应该像 它应该只背景图像区域的单元格和表格不是灰色边框在第二个表谢谢。UITableView分组背景图片

enter image description here

回答

4

使用以下代码。

self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Background.png"]]; 

对于另一种方式来设置分组UITableView backgroung图像读取This documentation.

+0

但它添加侧形象也为分组表 – 2013-02-25 06:45:06

+0

@ NaziaJan-试试这个代码???可能解决您的问题:) – iPatel 2013-02-25 06:46:27

+0

它不工作 – 2013-02-25 06:54:40

1
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"TableViewBackground.png"]]; 
[tempImageView setFrame:self.tableView.frame]; 
self.tableView.backgroundView = tempImageView; 
[tempImageView release]; 
-2

而不是给背景图像以table.Provide背景图像/色彩到细胞。

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

since colorWithPattern is very expensive which causes memory leak,avoid using colorWithPatternImage 

instead you can use 
cell.backgroundColor=[UIColor initWithRed:0.25 green:0.25 blue:0.25 alpha:1]; 


//change the RGB as per the image 
+0

这里我们要显示单元格的背景不tableview。 – Praveen 2013-02-25 07:31:03

+0

你好,我读了bhai。如果你知道只有一种找到解决方案的方法意味着更多,还有其他数千种方法可供玩耍。 – Praveen 2013-02-25 07:41:51

+0

是的,所以请申请我提供的解决方案,而不是投票,并通过时间.SF ... – Praveen 2013-02-25 09:01:14