UIImageView/UIImage “Memory Tag 70” release timing when scrolling

前端 未结 3 383
谎友^
谎友^ 2021-01-01 07:58

I have a long horizontal paged scrollview, for each page, I put a fullscreen UIImage.

As it is expensive and not necessary to add all UIImage at once, currently I la

3条回答
  •  无人及你
    2021-01-01 08:06

    From your graph it appears the memory consumption levels off, which is consistent with the images being cached and then released when the scroll stops (perhaps throughg an internal autorelease in the scrollview). That caching and memory buildup is probably making your scrolling smoother. If you really need to prevent memory build up then you will need to alloc and release the images manually yourself (echoing AnlmlsH's suggestion of forgoing imageNamed).

    But eliminating caching may result in jerkly scrolling....classic time/space tradeoff, and you need to determine which one is more important for your app's case.

提交回复
热议问题