nicklockwood/iCarousel — Issue #54: Loading views in background thread
Author: bolshas
Created: 2011-11-04 22:48:21+00:00
State: open

Hi,

I am loading a large list of imageviews to carousel like this:

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index {
UIImage *img = [[Globals sharedGlobals] smallImageAtIndex:index];
UIImageView *imgView = [[[UIImageView alloc] initWithImage:img] autorelease];
return imgView;
}

Where Globals is my singleton class.

All images are png files stored in the Documents folder. No transformations or additional drawing is performed. All images' size is 300 x 300 pixels.

I am using 19 in numberOfVisibleItemsInCarousel which loads the carousel almost instantly.

The scrolling of carousel is swift in the iPad simulator, but there is a very slight (but noticeable) lag when performing fast swipes on the actual device. I am using the rotary type by the way.

I was wondering if implementation of loading of unallocated views into the visible array on the background thread would help eliminate this lag?

Also, since I'm quite new to Xcode, I would very much appreciate if someone would share a snippet of this implementation if there is one.

Thanks and kind regards,

Andrius