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 · 7 comments

Comments

@BestKai
Copy link

commented Dec 30, 2015

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

@ibireme

This comment has been minimized.

Copy link
Owner

commented Dec 30, 2015

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

@ibireme ibireme added question discussion and removed question labels Dec 30, 2015

@BestKai

This comment has been minimized.

Copy link
Author

commented Dec 30, 2015

有没有优化的方案?

@ibireme

This comment has been minimized.

Copy link
Owner

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

This comment has been minimized.

Copy link

commented Jan 6, 2016

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

@ibireme ibireme closed this 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

This comment has been minimized.

Copy link

commented Apr 18, 2017

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

@meigesir

This comment has been minimized.

Copy link

commented Jul 3, 2017

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

@frankfan1990

This comment has been minimized.

Copy link

commented Apr 17, 2019

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

噗~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.