我試圖得到了每一個細胞自身的背景,但它看起來像:單元格背景
這裏是我與
cell.team1Label.backgroundColor = [UIColor clearColor];
cell.team2Label.backgroundColor = [UIColor clearColor];
cell.dateLabel.backgroundColor = [UIColor clearColor];
cell.timeLabel.backgroundColor = [UIColor clearColor];
cell.stadiumLabel.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cell.png"]];
感謝
「任何其他視圖」我的意思是容器視圖,其中包含所有標籤或類似的東西。如果有任何這些,你應該將他們的backgroundColor設置爲[UIColor clearColor] – 2011-04-15 20:33:05
有一點需要注意的是與tableview單元格中使用的透明視圖相關的潛在性能損失。文檔引述如下:「如果你確實採用這種方法,儘可能避免使視圖透明。透明子視圖會因合成成本增加而影響滾動性能」http://developer.apple.com/library/ios/文檔/ UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#// apple_ref/doc/uid/TP40007451-CH7-SW15 – 2011-04-16 06:48:29
實際情況並不差,但是,使用不透明圖像會是一個更好的性能決定。 – 2012-04-29 15:24:54