bluetooth99 2013-03-04 02:31 采纳率: 0%
浏览 1957

屏幕修改后不需要重新加载数据

在表单元中放了自定义颜色,可以修改环境。代码实现了修改颜色功能。但是我发现每次获取颜色时都要重新加载数据。有没有别的方法?

代码:

-(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];
}
  • 写回答

1条回答

  • ArcRain 2013-03-06 15:50
    关注

    [self.tableVerseView reloadData];
    如果数据集合没有变化,只刷新对应的行就好了。
    用UITableView的方法试试:reloadRowsAtIndexPaths:withRowAnimation:

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿