zoukankan      html  css  js  c++  java
  • 数据刷新

    数据刷新

    • 添加数据
    • 删除数据
    • 更改数据

    全局刷新方法(最常用)

    [self.tableView reloadData];
    // 屏幕上的所有可视的cell都会刷新一遍

    局部刷新方法(性能高)

    • 添加数据
    NSArray *indexPaths = @[
                            [NSIndexPath indexPathForRow:0 inSection:0], // 0组0行
                            [NSIndexPath indexPathForRow:1 inSection:0]  // 0组1行
                            ];
    [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationRight];
    • 删除数据
    NSArray *indexPaths = @[
                            [NSIndexPath indexPathForRow:0 inSection:0],
                            [NSIndexPath indexPathForRow:1 inSection:0]
                            ];
    [self.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationMiddle];
    • 更新数据(没有添加和删除数据,仅仅是修改已经存在的数据
    NSArray *indexPaths = @[
                            [NSIndexPath indexPathForRow:0 inSection:0],
                            [NSIndexPath indexPathForRow:1 inSection:0]
                            ];
    [self.tableView relaodRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationMiddle];
  • 相关阅读:
    MapReduce Design Patterns(2. 最大值、最小值、总数、个数、均值)(二)
    MapReduce Design Patterns(2. 最大值、最小值、总数、个数、均值)(二)
    MapReduce Design Patterns(chapter 1)(一)简介
    MapReduce Design Patterns(chapter 1)(一)简介
    Hadoop中两表JOIN的处理方法
    MapReduce数据处理两表join连接 (Ruduce端连接)
    笔记:Java 性能优化权威指南 第4章 JVM性能监控
    笔记:Java 性能优化权威指南 第3章 JVM概览
    笔记:Java 性能优化权威指南 第2章 操作系统性能监控
    启用 jstatd 供远程VisualVM 连接
  • 原文地址:https://www.cnblogs.com/LongLJ/p/5001993.html
Copyright © 2011-2022 走看看