0
我有以下方法,它適用於我想要的。更改整個應用程序的UITableViewCell的背景視圖
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
UIView *colorView = [[UIView alloc] init];
colorView.backgroundColor = [UIColor darkGrayColor];
[cell setSelectedBackgroundView:colorView];
cell.selectedBackgroundView = colorView;
}
現在,有沒有辦法模仿這種行爲對整個應用程序,而不是增加這種方法每tableViewController
?
你可以只用'[的UITableViewCell外觀]'。 – 2014-09-01 23:12:06
謝謝,這工作。哪裏是添加此代碼的最佳地點? 'AppDelegate'? 'rootViewController'? – Jorge 2014-09-01 23:22:42
只要你在顯示任何表格視圖之前執行它,任何一個都可以。就我個人而言,如果可能的話,我喜歡避免將過多的東西放入應用程序代理中。 – keeshux 2014-09-01 23:25:46