2011-08-18 82 views

回答

3
if (cell == nil) { 

    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 
    UIView *v = [[[UIView alloc] init] autorelease]; 
    v.backgroundColor = [UIColor blueColor]; 
    cell.selectedBackgroundView = v; 

使用本

+0

謝謝,它保留了我從細胞的繼承。我不知道有一個selectedBagroundView –

2

您需要繼承UITableViewCell,並覆蓋下列方法:

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; 
- (void)setSelected:(BOOL)selected animated:(BOOL)animated; 

您可以更改單元格的背景圖片在那裏。

該單元的selectionStyle屬性也允許進行一些非常基本的自定義。

相關問題