ios 修改UITableViewCell的backgroundColor

来源:互联网 发布:java中青色怎么表示 编辑:程序博客网 时间:2024/05/04 05:02

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了。

原创粉丝点击