Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableView reload 时,YYLabel 有闪动 #64

Closed
BestKai opened this issue Dec 30, 2015 · 8 comments
Closed

TableView reload 时,YYLabel 有闪动 #64

BestKai opened this issue Dec 30, 2015 · 8 comments

Comments

@BestKai
Copy link

BestKai commented Dec 30, 2015

在demo的微博列表里,reload tableView tableView 会发生闪屏的现象。这是为什么?

@ibireme
Copy link
Owner

ibireme commented Dec 30, 2015

TableView 内的所有文本控件,都是异步绘制的,我猜可能与这个有关。

@BestKai
Copy link
Author

BestKai commented Dec 30, 2015

有没有优化的方案?

@ibireme
Copy link
Owner

ibireme commented Dec 30, 2015

既然是 "异步绘制",这个问题基本上是避免不的。。

几个方案:

  1. 尽量避免用 [tableView reloadData] 方法,用 insertRows、deleteRows、reloadRows 替代。
  2. 禁用文本的异步绘制,但这会降低界面的流畅性。此处可以在 reloadData 之前禁用,在之后再启用。
  3. reloadData 之前,截取 tableView 作为图片覆盖,在 reloadData 之后,等待 0.3 秒左右再移除。或者,直接在 tableView 的 layer 上加个渐变动画。
  4. label. clearContentsBeforeAsynchronouslyDisplay = NO; 这样做会没有闪动,但是内容更新可能稍有滞后。这个可以实际测试一下看看效果。

@yangchao0033
Copy link

原来截图覆盖是在这用的!

@ibireme ibireme closed this as completed Jan 17, 2016
@ibireme ibireme changed the title tableview reload 发生闪屏 Table reload 发生闪屏 Mar 17, 2016
@ibireme ibireme changed the title Table reload 发生闪屏 TableView reload 时,YYLabel 有闪动 Mar 17, 2016
@Quanhua-Guan
Copy link

可以配合IGListKit使用, 赞! https://github.com/Instagram/IGListKit.git

@meigesir
Copy link

meigesir commented Jul 3, 2017

所以果断不再使用这个库,而且YYLabel竟然Text和AttributedString不能切换使用,否则会出现颜色不对、大小不一各种issue,浪费了时间,决定弃用,起因是同事推荐使用

@frankfan1990
Copy link

所以果断不再使用这个库,而且YYLabel竟然Text和AttributedString不能切换使用,否则会出现颜色不对、大小不一各种issue,浪费了时间,决定弃用,起因是同事推荐使用

噗~

@hustlzp
Copy link

hustlzp commented Sep 3, 2020

使用 iOS 13 的 DiffableDataSource 也还是有闪烁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants