Universal application iPad/iPhone image naming convention?

前端 未结 5 1776
有刺的猬
有刺的猬 2021-02-07 12:59

In my application I need to get the correct image based on the device iPad/iPhone 4/iPhone 3 device.

For example:

I have an image named a.png (widt

5条回答
  •  心在旅途
    2021-02-07 13:38

    There is no image naming convention for iPad, it's only for retina displays so that your images will appear crisp. If you want to support iPad then you need to create a separate layout for it (separate xib), even separate set of images in most cases because you were given a bigger layout.

    You can, however, create a naming convention for yourself and pass the string name to a static function that will convert the name to an iPad / iphone depending on the device.

    E.g.

    [UIImage imageNamed: [MyAppUtils getImageName:@"a.png"]];
    

    and inside the getImageName function, you can do your conversion (use the same name if iphone, else rename to something else)

提交回复
热议问题