Skip to content

TableView reload 时,YYLabel 有闪动 #64

Closed
@BestKai

Description

@BestKai

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

Activity

ibireme

ibireme commented on Dec 30, 2015

@ibireme
Owner

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

BestKai

BestKai commented on Dec 30, 2015

@BestKai
Author

有没有优化的方案?

ibireme

ibireme commented on Dec 30, 2015

@ibireme
Owner

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

几个方案:

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

yangchao0033 commented on Jan 6, 2016

@yangchao0033

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

changed the title [-]tableview reload 发生闪屏[/-] [+]Table reload 发生闪屏[/+] on Mar 17, 2016
changed the title [-]Table reload 发生闪屏[/-] [+]TableView reload 时,YYLabel 有闪动[/+] on Mar 17, 2016

4 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ibireme@hustlzp@meigesir@Quanhua-Guan@frankfan1990

        Issue actions

          TableView reload 时,YYLabel 有闪动 · Issue #64 · ibireme/YYKit