博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tatableView 刷新
阅读量:6928 次
发布时间:2019-06-27

本文共 862 字,大约阅读时间需要 2 分钟。

1.一般情况下,刷新tableView,我们会直接调用reloadData方法   

    [self.tableView reloadData];

 但是有的时候我们需要刷新指定的cell和section,这个时候在调用reloadData的话,就浪费资源了。

2.刷新局部的cell

 NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

 [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationFade];

 

3.刷新局部的section

NSIndexSet *indexSet = [[NSIndexSet alloc] initWithIndex:0];

 [self.tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationFade];

 

4.刷新动画

typedef NS_ENUM(NSInteger, UITableViewRowAnimation) {

    UITableViewRowAnimationFade,

    UITableViewRowAnimationRight,           

    UITableViewRowAnimationLeft,

    UITableViewRowAnimationTop,

    UITableViewRowAnimationBottom,

    UITableViewRowAnimationNone,            

    UITableViewRowAnimationMiddle,          

    UITableViewRowAnimationAutomatic = 100  

};

 

转载于:https://www.cnblogs.com/fantasy3588/p/4744533.html

你可能感兴趣的文章
Exchange企业实战技巧(16)发布SMTP、POP、IMAP连接信息设置
查看>>
烂泥:【解决】mysql数据库报ERROR 104错误解决
查看>>
python下载文件的几种常用方法
查看>>
运维自动化之ansible的安装与使用(包括模块与playbook使用)
查看>>
怎么样才叫精通Linux
查看>>
自动Shader优化器glsl_optimizer的编译与使用
查看>>
ZoneMinder配置与使用
查看>>
《VMware系统集成工程师》课程大纲
查看>>
在VMware ESXi中使用固态硬盘的注意事项
查看>>
戴尔“蓝雷”炸响软件定义存储
查看>>
华为PowerApp为开发者提供“能量”
查看>>
磁盘性能 -- IOPS 和 吞吐量 说明
查看>>
制作Ubuntu deb包方法
查看>>
WinForm 跨进程传输数据
查看>>
[zz]HDFS文件系统和OpenStack swift对象存储有何不同
查看>>
jdk安装配置
查看>>
数据类型范围》
查看>>
Miller-Rabin素数测试学习笔记
查看>>
Wireshark运行问题:"The NPF driver isn’t running…"(NPF驱动没有运行)
查看>>
STM32使用ST库新建工程
查看>>