2012-03-16 92 views
2

我正在设计我的第一个iOS应用程序(第一次在Stackoverflow上),并在我的MasterViewController.m下的viewDidLoad中使用以下代码来显示我的表格视图的自定义背景。从单元格中重复背景图像停止表格视图

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bookshelfbg.jpg"]]; 

这意味着要显示整个表的背景,并且单元格有自己的背景。问题在于每个单元格都使用它的背景(大部分是透明的),但也可以平铺或开始为我为表格视图设置的背景图像。我已将单个单元格的背景更改为清除,并且完全删除了我设置的单元格背景图像。

这里是我的下细胞(UITableViewCell中)的代码:

{UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyBasicCell"]; 
    BookQueueDoc *book = [self.books objectAtIndex:indexPath.row]; 
    cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"shelfcellbg.png"]]; 
    tableView.separatorColor = [UIColor clearColor]; 

谢谢您的帮助!

回答

0

cell.contentView不是所有的细胞区域。试试cell.backgroundColor

相关问题