I want to create an iOS app that utilizes full-screen photographs, which may turn into a lot of wait time for the end user if they are on a slow connection. Instead of showing them a "loading" icon, I want to display the image as it loads either linearly (from top to bottom the way a web browser might load images) or more interestingly, in a non-linear fashion. By that I mean, is there a function/method that would load pixels/sections randomly from any part of the image until the image is fully complete?
Asked
Active
Viewed 115 times
1 Answers
2
You should look at
CGImageSourceCreateIncremental and CGImageSourceUpdateData
You can also try NYXImagesKit library (https://github.com/Nyx0uf/NYXImagesKit)
Algorithm description - http://cocoaintheshell.com/2011/05/progressive-images-download-imageio/
Sample:
NYXProgressiveImageView * imgv = [[NYXProgressiveImageView alloc] init];
imgv.frame = CGRectMake(0, 0, 320, 480);
[imgv loadImageAtURL:[NSURL URLWithString:@"http://yourimage"]];
[self.view addSubview:imgv];

Avt
- 16,927
- 4
- 52
- 72
-
Thanks! Looks like this is the progressive version. Do you know of any function that would instead load random pixels/areas until the image is fully loaded? – user3314426 Feb 15 '14 at 22:55
-
No. It should be rather difficult - I do not think there is a Cocoa class that supports random (non-progressive) image displaying. Anyway you can try to find a third-party library for that. – Avt Feb 15 '14 at 23:03
-
Also you can use images with interlace - probably it will a little improve loading/displaying process. – Avt Feb 15 '14 at 23:05