Save space: Batch resize all @ 2x images for older iPhones / iPads / iPods on first launch

The problem with this: iphone 4 - loading x images of old devices

lies in the fact that we are completing filling our applications with double content. Those. the user must download both its 2x size and the 1x image to his device, but in the end he will use only one of them, and the other will be a waste of download time, etc.

Therefore, I thought that in some cases this can be normal, only filling the application with high-resolution images (@ 2x) and when starting the application (in the application delegate, before displaying the window ... or something else) you can perform batch scaling all @ 2x shots for low-resolution devices. When you zoom out, you save these files in the deviceโ€™s documents and / or cache folder and delete the original @ 2x images. How about this, did anyone do this? (My googles, they do nothing) Any downsides to this? Will Apple hit me somewhere for this? etc...

+1
source share
2 answers

You can definitely batch scale these @ 2x images and save the scaled files in a document folder. This will save loading time and use the same space as everything associated with your application, due to some additional complexity. I donโ€™t think that deleting the original @ 2x images is possible, however, even if itโ€™s worth it, there is the possibility of moving applications and user data between devices. It would be best to choose the right resolution based data as soon as you receive it. And I donโ€™t see the big reason Apple could hit you for that.

Oh, and, of course, if you really have a lot of data, in the order of hundreds of megabytes, running two versions of the application may make sense (for example, in the spirit of Rage).

+1
source

Now I am going to answer my thoughts.

  • when performing a batch, you need to save the images in the cache / documents folder or something like that. This means that any image specified in IB will still not be found by low-resolution devices, perhaps they will not be found using the usual imageName, etc. (Not sure about this yet). This may be a fix, or I may have to tinker with adding images manually to viewDidLoad. Smells are dirty. May work, with a good solution ...

  • may be unpleasant with app updates. Since application updates are slowly published (sorry Apple, yes, updates are slowly published). When updating, you probably want to erase the cache folder to make sure that old images that have been modified / deleted with the update are not yet stored in the cache. Caching should be controlled by some version control. How to check the current version of the application, and if caching is performed for this version. If not, update cache, stream type.

0
source

All Articles