When you launch the gallery you're presented with the thumbnail then
after a couple of seconds the image changes to the higher resolution
image. Is there a way to continue loading pictures in the background
so when someone flips to the next picture it's clear right away?
Many Thanx!
hello Bill have you found any solution for this?
--
To learn more about Three20, check out http://three20.info
You received this message because you are subscribed to the Google
Groups "Three20" group.
To post to this group, send email to thr...@googlegroups.com
To unsubscribe from this group, send email to
three20+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/three20?hl=en
I subclassed TTPhotoViewController, and overrode the updateChrome method:
-(void) preFetchNextImages:(NSInteger)count {
for (int i = 1; i<=count; i++) {
NSInteger nextIndex = self.centerPhotoIndex + i;
if ( nextIndex >= [[self photoSource] numberOfPhotos] ) {
// we're at the end, stop
return;
}
[self preFetchImageAtIndex:nextIndex];
}
}
-(void) preFetchImageAtIndex:(NSInteger)index {
id<TTPhoto> nextPhoto = [[self photoSource] photoAtIndex:index];
TTDINFO(@"prefetching photo at index: %d file:
%@",index,[nextPhoto URLForVersion:TTPhotoVersionLarge]);
TTURLRequest *request = [TTURLRequest requestWithURL:[nextPhoto
URLForVersion:TTPhotoVersionLarge] delegate:self];
request.response = [[[TTURLImageResponse alloc] init] autorelease];
[request send];
}
- (void)updateChrome {
[super updateChrome];
TTDINFO(@"update chrome called: prefetching next image");
NSInteger numberOfImagesToPrefetch = 5;
[self preFetchNextImages:numberOfImagesToPrefetch];
// just for my debug purposes
[[TTURLCache sharedCache] logMemoryUsage];
}
I locally modified TTURLCache to adjust the kLargeImageSize constant
to cache larger images:
static const CGFloat kLargeImageSize = 2048 * 2048;
There are better ways to do the above override but alas, I am lazy :)
Hope that helps,
Yoshi