UIImageView Animation too much memory consumption

后端 未结 4 1944
梦如初夏
梦如初夏 2021-01-14 03:39

I have a problem with memory and images that I am animating. First thing first, I am using ARC. On my initial screen I have about 60 images to animate. I am using this code

4条回答
  •  轮回少年
    2021-01-14 03:49

    You should try replacing [UIImage imageNamed:] with [UIImage imageWithContentsOfFile:].

    From the docs:

    If you have an image file that will only be displayed once and wish to ensure that it does not get added to the system’s cache, you should instead create your image using imageWithContentsOfFile:. This will keep your single-use image out of the system image cache, potentially improving the memory use characteristics of your app.

提交回复
热议问题