回答

0

UITableView具有backgroundView屬性,它用於顯示分組樣式的細條紋。您可以替換背景視圖或添加到背景視圖。如果你更換它,你會失去細條紋。

[myTable.backgroundImage addSubview:myImage]; 
[myTable.backgroundImage addSubview:myLabel]; 
+0

我將UIImage添加到tableview標題 – 2010-05-25 11:51:51

0

您不必定義自定義單元格,就可以使用標準的UITableViewCell。它具有文本和圖像的屬性。將圖像分配給imageView屬性,將文本放入textLabel屬性中。

0

根據圖像的大小和所需的位置,您可以使用UITableViewCellimageView屬性。從本質上講,你的cellForRowAtIndexPath看起來就像這樣:

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    //Normal cell setup 
    cell.imageView.image = myImage; 
    cell.textLabel.text = imageDescription; 
    return cell; 
} 

,將在與文本左邊緣後,在中/右邊緣創建圖像的細胞

+0

感謝您的代碼,但我想放置一個UIImage和文本以外的單元格。我希望它出現在灰色的細條紋區域。 – 2010-05-24 23:10:54

0

[self.tableView addSubview:myImageView] ; [Self.tableView sendSubviewToBack:myImageView];

或者

self.tableView.backgroundColor = [的UIColor colorWithPatternImage:[UIImage的imageNamed: 「myimage.png」]];

使用Photoshop將東西放置在細條紋圖像的頂部。