tags:

views:

896

answers:

4

Hi, I have to create same functionality as facebook has does like all the photos display at one view and from that user can choose photo and it goes to large photo. This photos are showing very fast. I have 5 photos from web but it take so much time. Does anyone know how they shows photo very fast.

+1  A: 

I don't know about the iphone app in particular, but I do know that the main facebook website prefetches images in photo albums.

Jason Watkins
+6  A: 

I don't know the answer but I suggest you look at the three20 source code on github. Joe Hewitt (who wrote the Facebook app) published much of its code including the photo view. There is also a Google group that discusses three20.

Roger Nolan
A: 

Thank your answer, Now i am simply pulling photo from web like this way,

NSURL *url = [NSURL URLWithString:@"http://us.i1.yimg.com/us.yimg.com/i/us/bf/gr/bf_large2_2.gif"];

NSData *data = [[NSData alloc] initWithContentOFUrl:url];

UIImage *urlImage = [UIImage imageWithData:data];

But its very slow, i checked this three20 source code, but the problem is that already my apps has RouteMe external code and if i will put three20 code then my app size will cross that 4 MB.

So is there any another way to do this?

What 4Mb are you referring to? Three20 definitely does what you want to do.
Roger Nolan
4MB means my applciation size is no 4MB and if will use three20 then it will be more than 5.5MB. is it okay?
The reason it is slow is that you're doing it synchronously in the main thread. You need to come up with an a-sync display method.
Hunter
A: 

Facebook creates multiple sizes of each photo when it is uploaded. They also convert all the photos to png I'm pretty sure, likely reducing the file size of the original photo. I know creative has often complained about the "quality" of photos after uploaded to Facebook.

This allows them to deliver the appropriate sized image (both dimensions and file size) for quick display rather than delivering a full sized image and having the client resize it.

Brent Baisley