nytimes / NYTPhotoViewer

A modern photo viewing experience for iOS.
http://open.blogs.nytimes.com/2015/03/27/a-new-view-for-nytimes-photos/
Other
2.86k stars 378 forks source link

Lazy loading for each photo in NYTPhotoViewer #162

Open jacks8x opened 8 years ago

jacks8x commented 8 years ago

I just see below approach to use NYTPhotoViewer, follow this approach I have to init photos array with image data first (image data is very big compare with it's path or it's name), so in case I have 10000 or more photos, my photos array will very large and it will maybe out of memory or the app willbe freeze. How can I resolve this problem.

NYTPhotosViewController *photosViewController = [[NYTPhotosViewController alloc] initWithPhotos:photos];
[self presentViewController:photosViewController animated:YES completion:nil];
cdzombak commented 8 years ago

@jacks8x this is a good point; lazy loading isn't something that the library currently allows.

As far as I know it's not in our plan, but we'll leave this issue open as a reminder, and pull requests would be welcome for discussion (though note that any pull request for this should probably take #163 into account, too).

kimar commented 8 years ago

I had to implement a lazy loader incl. a way to maintain interaction while a hi-res version of an image is loading. A provisional PR is here -> https://github.com/NYTimes/NYTPhotoViewer/pull/160

Although I'm sure this should also be part of the bigger picture aka #163

SkylerSeamans commented 7 years ago

I'm also seeing issues with this. When loading a large array of images, many of the images at the end of the array have timed out due to network saturation. Lazy loading for images is a pretty standard mobile paradigm and without support, I'll be looking for another library or writing my own ViewController to handle this.