ios: how to fix memory warning issue when showing lots of thumbnails(over 3000) by using NSCache?

76 Views Asked by At

I write a table view/collection view to show lots of photo. I use dispatch queue to load photo from Internet and use NSCache to cache photo (for not loading photo from internet again).

when I loaded over 2000 photo, app received memory warning. I tried to release the content of nscache in didreceiveMemoryWarning(), or set the nscache delegate to let nscache to auto release nscache content.

after releasing the content of nscache and I scrolled to the top of the table view,

  • sometimes: the thumbnail load different images several times (show image1, image5, image 6)
  • sometimes: the thumbnail won't show anything

I guess what caused this happened is --> using dispatch queue to show thumbnails in table view


but I don't know how to fix it!!

anyone knows? or is there any better way to show lots of photos(over 3000)?

thank you!!

0

There are 0 best solutions below