I have a tableview that only holds a few (~5)cells with a large image in each cell. Is it possible to preload all the cells to improvescrolling performance? Right now, there is a slight jerk when each cell is loaded. Thanks!
+1
A:
I don't think it's possible to tell the TableView directly to pre-create all of its cells, but assuming that the slow part is loading your images, you could certainly pre-load your images, keep them in an NSArray or something, and then putting them into the cells as they're created should be fast.
David Maymudes
2009-08-29 08:27:45
How should I go about preloading my images?
Jonah
2009-08-30 21:35:34
+1
A:
Yes. You can. And it eats memory but performance will be maximized.
But only do it when you are SURE that the cells are not too big. Also don't ever forget to release them.
Mike Chen
2009-08-29 13:13:49
A:
I found out that the reason my tableview was scrolling poorly was because of how the photos were being loaded. Using imageNamed to load the images fixed all my problems.
UIImage *theImage = [UIImage imageNamed:[[appDelegate.myDelegateDict objectAtIndex:indexPath.section] objectForKey:@"MainImage"]];
Jonah
2009-09-05 04:05:45
Yes but it will retain the images in memory, not release them. So if you have lots of images, you can eventually crash the app.
just_another_coder
2010-08-21 19:03:03