Hello.
How to do optimization for different screens of mobile touchscreens (androids, iPhones)?

    3 answers 3

    On Android, this is pretty well documented. As I understand from the context we are talking about pictures - everything is quite simple. It is necessary to prepare in the general case 4 different images for different devices (depending on dpi):

    1. Low resolution ~ 120 dpi
    2. Medium resolution ~ 160 dpi
    3. High resolution ~ 240 dpi
    4. Very high resolution ~ 320 dpi

    All these resources are put in the drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi folders, then the OS will take them "by itself" depending on the device resolution.

    More detail here

      For different screen resolutions (and sizes, respectively) in android there are special resource size qualifiers. It is enough to save resources to the required directory (images, layout files ...) and the system will automatically determine what type of resource to load depending on the current display or orientation. You can read more on off.site

        About the Android does not know, in the iPhone two versions of the picture are inserted - sample.png and sample@2x.png and for the retina @ 2x pictures are automatically substituted, for iPad individual xib-be made

        Retina is an iPhone display from version 4, it has a higher resolution (960x640 vs. 480x320 for 2G, 3G and 3GS) and images are created for it with that resolution and name@2x.png, respectively, the project also includes pictures for old models with the name name.png, they are the ones in the code that are used, and what the system itself loads is decided Xib is a special file that stores the appearance of application forms (they are called View, actually, but I called them forms so as not to be confused), because the iPad has a different aspect ratio, they make their layout for it and put it in a separate file (by the way, they also localize pictures - they make different files for different languages), this can be done using the media as far as I remember

        • If not hard, please give a more detailed answer and without words like "retina", "xib-would", etc. These words are not clear to me. - Anton Mukhin
        • 2
          I did, but how are you going to do something if you don’t know what it is? - aknew
        • I am making a web app in javascript. I do not work with programs. Therefore, I do not know what is there and how inside. But in general, the idea is clear to me. Let's wait for more offers. Maybe there is some kind of universal method for any phones. Maybe something else. - Anton Mukhin
        • Yes, Obj-C. If the web, then probably my answer is a little out of place, did not see the web tag. - aknew