UITableView 我们用得很多,有时候我们需要修改UITableViewCell的backgroundColor。
我们经常在UITableViewDataSoure的协议方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
中定制我们需要在UItableViewCell里展示的内容,但无法在这个协议方法中修改它的backgroundColor。
其实我们要修改UITableViewCell的backgroundColor可以在UITableViewDelegate协议方法
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
中去修改,在这个方法里我们就可以顺利修改UITableViewCell的backgroundColor了。