0
votes

I am developing portrait resolution app which will support all iPhone screens. I am not scaling so i have to cater every Screen size. iPhone 6 plus have 1242 x 2208 (@3x) for portrait and iPhone 6 have 750 x 1334 (@2x) for portrait.

Normally i would create full width image graphics in 320@1x, 640@2x and 960@3x. But now it wont work. Do i have to make full width sized images separate for every resolution?

Like i would create 640@2x for iPhone 5s or earlier and 750@2x for iPhone 6 and 1242@3x for iPhone 6 plus.

Do i have to make different images for every resolution? Am i going in right Direction or there is a better solution?

1

1 Answers

1
votes

The iPhone 6 and iPhone 5 uses the same @2x images, but as the resolution is different on both the devices it's best practice to get the different images for both.

On iPhone 6, if the image of iPhone 5 will be loaded then you will see some distortion.

On other hand, if you have image of 750 x 1334 (@2x) for iPhone 6 and if you will load that ion iPhone 5 or 4 then you will see squeeze image as it is of higher resolution.

But the problem is that if you put both iPhone_5@2x and iPhone_6@2x then Xcode will not that which image to be loaded on which device. So, for that I have made a function to differentiate the images at runtime.

//MARK: Load Images for particular device
func getDeviceSpecificImage(imgName: String) -> String{

var imageName: String?

    switch UIScreen.mainScreen().bounds.width{

        case 320:
            imageName = String(format: "%@_5@2x", imgName)

        case 375:
            imageName = String(format: "%@_6@2x", imgName)

        case 414:
            imageName = String(format: "%@_6+@3x", imgName)

        default:
            break
    }

    return imageName!
}

Hope this helps!