Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

harryslotwiner

macrumors newbie
Original poster
Mar 28, 2012
19
0
Hello,

So I have an application in which I am downloading a fair share of images and putting them into UIImageViews like so
Code:
ImageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString: imageURL]]];

The problem is that this is at the launch of the application and can take 10-15 seconds which is agonizingly boring to watch, is there any way that I could load them in a more efficient manor (Without lowering the image quality)?

If not, in your opinion is it preferable to wait 10-15 seconds at the launch of the application, or have the app delay about half a second when you swipe to the next image set?

Thanks for any help.
 
Are you using any kind of a background load like NSThread or GCD?

I just uploaded my first app Wednesday to the app store and in my app I am downloading a bunch on images in the background while I present the user the rootViewController for them to interact with. If they click on something that is not loaded yet I display a loading bar to show it's progress.
 
Hey, I wasn't and that was the problem.

To answer my own question, I found a really great "Framework" of sorts that is a really easy to implement and program to. It's just a slight adaptation to a UIImageView that keeps all of the normal attributes while adding simple image settings methods like:
Code:
imageview.imageurl = @"http://www.example.com/image.png";
And then it runs the image loading threads in the background.

And it also seems to use much less resources. I found a significant drop in memory that my application was using. So I highly recommend checking it out here: https://github.com/enormego/EGOImageLoading

Thanks for the response though.
 
You can also download the images once, store them in a local database/documents, and at startup check if any images are already downloaded, and if so, use the ones from the database, otherwise lazy load them from the internet so it doesn't block the interface :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.