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];
  • 相关阅读:
    [转]Delphi DLL的创建、静态 以及动态调用
    Delphi txt文件的操作(读取、写入)
    为什么要使用动态链接库(DLL)
    TStringGrid 实现下拉框
    Ryzen 4000'Vermeer' CPU和Radeon RX'Big Navi'图形卡
    AMD Ryzen 5000‘Cezanne’APU
    AMD–7nm “Rome”芯片SOC体系结构,支持64核
    ARM Cortex-M嵌入式C基础编程(下)
    ARM Cortex-M嵌入式C基础编程(上)
    基于ARM Cortex-M的SoC存储体系结构和实战
  • 原文地址:https://www.cnblogs.com/LongLJ/p/5001993.html
Copyright © 2011-2022 走看看