2012-03-16 42 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

相關問題