The Coder
The Coder

Reputation: 121

How images are used from xcassets?

I am having icons for the app stored in xcassets for all 3 versions (@1x,@2x and @3x).

Size of an Asset: { @1x: 28, @2x: 56, @3x: 84}

But when I was trying to read the image size of one of the xcasset item in iPhone6, it showed me 28, which is the size of image to be loaded on iPhone4. I wish to know, if this is the behaviour of iOS or something's wrong on my side.

Thanks in Advance

Upvotes: 0

Views: 83

Answers (2)

NSSwift
NSSwift

Reputation: 215

May be you have put wrong asset in @3x place in your xcasset

enter image description hereand also There is one tool : AVXCassets Generator with which you can directly generate XCAssets file for all your icons and images just by one click.

Upvotes: 1

Ivan Alek
Ivan Alek

Reputation: 1919

UI Measurements in UIKit are performed in points instead of pixels. For example, retina screen have 4 pixels per one point, so if you try to read the size of your image at iPhone 5 for example you will get 28 points. On iPhone 6(s) Plus screen is even denser and thats why there is requirement for @3x images.

Upvotes: 0

Related Questions