在表单元中放了自定义颜色,可以修改环境。代码实现了修改颜色功能。但是我发现每次获取颜色时都要重新加载数据。有没有别的方法?
代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// testing for old selected color
if (checkedIndexPath)
{
// returning old checked cell back to blue
UITableViewCell *uncheckCell = [tableView cellForRowAtIndexPath:checkedIndexPath];
uncheckCell.backgroundColor = [UIColor blueColor];
}
// changing selected cell background color
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.backgroundColor = [UIColor greenColor];
checkedIndexPath = indexPath;
// reloadingtable data
[self.tableVerseView reloadData];
}