Skip to content

imageView .layer比直接用imageView加载图片快么 #47

@chengxianghe

Description

@chengxianghe

虽然最终的实现都是_YYWebImageSetter做的处理,但是我在用的时候发现好像是imageView.layer加载图片更流畅点,我想请教的是:
1 正常使用情况下,YYWebImage更推荐那种使用方式?
2 两种方式有什么区别呢?

Activity

ibireme

ibireme commented on Jan 15, 2016

@ibireme
Owner

UIImageView 显示 UIImage 时,内部处理逻辑更为复杂,它需要正确处理 UIImage 的 imageOrientationscalecapInsetsresizingMode 等属性,如果有 imagesCIImage 的话,它还要额外处理图片动画或滤镜。如果在某个场景下没有用到这些属性,那用 UIView.layer.contents 来显示 CGImage 是更高效的。

  1. 如果没有性能问题,还是用 UIImageView 更好一些。
  2. 两种方式最终都是用 layer.contents 来显示具体内容的,但 UIImageView 封装了更完善的逻辑。
chengxianghe

chengxianghe commented on Jan 15, 2016

@chengxianghe
Author

谢谢解答.

最近正在学习这个库,就流畅度上来说比SDWebImage强了不少,如果没有什么大问题,以后就可以用此库开发了.

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@chengxianghe

        Issue actions

          imageView .layer比直接用imageView加载图片快么 · Issue #47 · ibireme/YYWebImage