ios - How to improve performance of UITableView loading hundreds of Images from Documents Directory? -


i'm loading list of image files documents directory , setting them inside custom uitableviewcell, however, previous efforts have either been memory heavy, or resulting in bad uitableview scrolling performance.

in each of these methods, load image container class, , array.

what have tried:

  • uiimage+immediateload (a custom uiimage category loads image file path , loads straight memory. results in 60fps scrolling, crashing of application if user has on 100+ albums.)

  • the mpmediaitem valueforproperty:mpmediaitempropertyartwork method. (this however, causes scrolling frame rate drop dramatically. don't think directly loads images memory (correct me if i'm wrong).)

  • passing file path uitableviewcell itself, , having load image. results in slow scrolling too, not throttle memory.

these images can 1mb each.

in short (and know i'm asking lot), i'm asking way load images documents directory isn't hard on memory, , scrolls smoothly.

another strategy have ordered list of image paths , matching mutable array. user @ location 0. load images 0-10 in array. user scrolls keep last n images, free older ones (put nsnull in mutable array), , prefetch next n. struggles during active scrolling, sinc background work can cause scroll stutter. reduces memory pressure keeping relatively small set of data in memory @ given time.

other thoughts. can save uiimageviews instead of images. instead of tossing out of range images, throw them in nscache.

if else fails can photoscrollernetwork does, , prerender images in 1 massive file, use mmap grab pixels given image , create a cgimage. here trade off file system space speed.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -