2010-10-21 40 views

回答

1

UITableViewCelltextLabeldetailTextLabel都不會表現得像正常UILabel的。這可能是因爲UITableViewCell繪製它的文本,而不是因爲性能原因使用UILabel。這會導致行爲不一致,因爲單元格的繪圖會忽略backgroundColor屬性。

如果您所需的功能符合Apple工程師設計的默認單元處理的功能,請使用默認值UITableViewCell。對於所有其他功能,創建您自己的UITableViewCell的子類。

+0

嗯,夠公平的。 :)這是試圖解決另一個問題,而不是必要的。 :) – 2010-10-21 10:06:40

0

組這在表視圖委託方法

- (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath { 
[cell.detailTextLabel setBackgroundColor:[UIColor blackColor]]; 

} 
-3

cell.detailTextLabel.textColor = [的UIColor blackColor];