ios - Prevent Single Row from Refreshing in UITableView
问题描述
I have a custom section header in my UITableView that contains A UICollectionView of some avatar images. The data is sourced once and cached for the images (images change so infrequently that it doesn't warrant real time updates).
I was hoping to make it so this header never redraws again even if the UITableView refresh is called. The reasoning for this is every time you take action, it causes the images to flicker as they're being redrawn from their default anonymous silhouette to the actual image of the person. The images are cached, but it doesn't matter because
I assume this is not possible by design - a UITableView will destroy everything and reload it all over again every time the refresh is called, correct?
I just wish I could hook into the refresh and preserve the section header, and reload the rows only.
Thanks for any ideas/guidance, I know this is a little uncommon but I don't want to move the header out into its own view because i'm using a UITableViewController directly, and it would be a real pain to have to embed it in a containerview and all that.
解决方案
是的,即使您缓存了图像并通过本地或其他方式设置,加载也需要时间。如果您使用延迟加载,它将是飞溅(肯定:))。所以,唯一可能的事情是,你必须在刷新后更新你的 tableView 是使用tableView.beginUpdates
and tableView.endUpdates
。刷新后根据数据输入一些添加单元格或删除单元格
推荐阅读
- node.js - InvalidParameterValue:重复的标头“内容传输编码”
- python - 如何应用 Lambda 函数获得负周数?
- javascript - 将表单模板内容添加到 HTML
- ios - uiview over uinavigationcontroller
- html - 如何在 Angular 中为自定义组件实现伪事件?
- java - 为什么 Equals 和 Hashcode 对于对象列表是相同的,即使我没有为该对象实现这些方法
- regex - 值增加的正则表达式
- javascript - 替换 JavaScipt 中的引号符号
- javascript - 使用 keith wood 倒数计时器在 django 中倒计时
- typescript - 基础:无法处理模式的事件(输入,按钮),如果页面不只是重新加载