2011-09-06 54 views

回答

4

你應該爲了做到這一點,因爲實行的tableView委託方法是蘋果recomendation。

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { 
    cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.png"]]; 
} 

表視圖,它使用 細胞之前繪製一排,從而允許委託其顯示之前定製 細胞對象將此消息發送到它的委託。此方法爲委託人提供了一個 機會來覆蓋表 視圖之前設置的基於狀態的屬性,例如選擇和背景顏色。在代表 返回後,表視圖僅設置alpha和frame屬性,然後僅在行滑入或滑出時爲其設置動畫。

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

您可以創建一個圖像作爲背景的UIView,並將其添加到您的單元格中,然後您可以在UIView上添加其他控件和元素。