Uiscrollview lazy loading

前端 未结 4 1434
别跟我提以往
别跟我提以往 2021-01-06 20:59

I have got all images of iphone using AssetsLibrary.I am passing UIImage object in imageview and display images in scrollview. There are more than 200 images in iphone and i

4条回答
  •  鱼传尺愫
    2021-01-06 21:42

    You should only have loaded the images on the current page plus one or two in either direction. Only load images when you need them, keeping a limited buffer, and remove images after they have left the buffer. For example, if images 3 and 4 are on screen, images 1,2,5, and 6 should be loaded. When the user scrolls such that images 5 and 6 are on screen, it will keep images 3 and 4 loaded, will remove 1 and 2 from its memory, and will load 7 and 8 to make a new buffer.

提交回复
热议问题