[cell.detailTextLabel setBackgroundColor:[UIColor blackColor]];
不起作用。任何方式使它工作?爲什麼[cell.detailTextLabel setBackgroundColor:[UIColor blackColor]];不行?
感謝
[cell.detailTextLabel setBackgroundColor:[UIColor blackColor]];
不起作用。任何方式使它工作?爲什麼[cell.detailTextLabel setBackgroundColor:[UIColor blackColor]];不行?
感謝
的UITableViewCell
textLabel
和detailTextLabel
都不會表現得像正常UILabel
的。這可能是因爲UITableViewCell繪製它的文本,而不是因爲性能原因使用UILabel
。這會導致行爲不一致,因爲單元格的繪圖會忽略backgroundColor屬性。
如果您所需的功能符合Apple工程師設計的默認單元處理的功能,請使用默認值UITableViewCell
。對於所有其他功能,創建您自己的UITableViewCell的子類。
組這在表視圖委託方法
- (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath {
[cell.detailTextLabel setBackgroundColor:[UIColor blackColor]];
}
cell.detailTextLabel.textColor = [的UIColor blackColor];
嗯,夠公平的。 :)這是試圖解決另一個問題,而不是必要的。 :) – 2010-10-21 10:06:40