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];
  • 相关阅读:
    对post提交数据Content-Type的理解
    预加载的实现方式
    ajax跨域简单请求与复杂请求
    web前端图片模糊到清晰的实现过程
    vue子组件调用父组件的方法
    vue子组件如何向父组件传值
    如何实现下拉弹出框渐渐弹出
    DynamicObject扩展--实现JSON和DynamicObject的序列化与反序列化
    解决 Bash On Windows 下载慢或无法下载的问题
    NPOI扩展--判断指定单元格是否为合并单元格和输出该单元格的行列跨度(维度)
  • 原文地址:https://www.cnblogs.com/LongLJ/p/5001993.html
Copyright © 2011-2022 走看看