I have an iOS app in which I pull images from a server and display them for the user. It's image heavy (think facebook, instagram, etc.) I'm trying to keep the images under a certain size so that it's faster to pull them from the server, however when the internet connection isn't that great sometimes it still just churns and my app is just not very responsive. However when I load up instagram it seems to do a much better job at loading their pictures than my app. I'm hoping to figure out how I can better load images so the experience is a little better. Especially when the user's internet connection isn't the best.
I've noticed some apps (fancy for example) loads a small res image and displays that before it loads the fullsize image. In my mind I would rather just spend the processing power on getting the fullsize image from the beginning (unless maybe the image is going to take 15 seconds to load). Does anyone have a good argument for loading a small res image before the full res image?
I have a similar "feed" type app. I try to load each image when the user is about two images away, that way I don't load a bunch of images the user doesn't look at, while still loading images before they come into view. Is that the best way to handle it?
When the connection is bad then sometimes the image never gets loaded. It makes a request but it is just stagnant. If the image isn't loading how do you know when to kill the connection and start it again? I guess I could try playing with a timeout value of some type but I'm always scared I will set a timeout of 6 seconds and that my image will consistently take 7 seconds to download and it will never succeed.
Lastly, maybe I should be optimizing my images for each screen size on the server? When images are saved I could save 5 different sizes of the image for different screen sizes. That way iPhone 4's can pull down smaller images than the iPhone 6-pluses. Is this a good idea or just a waste of hard drive space?
Aucun commentaire:
Enregistrer un commentaire