size
The dimensions of the image, taking orientation into account.
(read-only)
@property(nonatomic, readonly) CGSize size
Discussion
In iOS 4.0 and later, this value reflects the logical size of the image and is measured in points. In iOS 3.x and earlier, this value
always reflects the dimensions of the image measured in pixels.
What is the difference between pixels and dots?
It’s still on iOS devices A standard measurement system is provided on the website, because no matter how the pixel density changes, there are always 320×480 dots on the iPhone screen and 768×1024 dots on the iPad screen.*
But at the same time, considering the retina The device was introduced in at least iOS 4, you can basically ignore these documents, I don’t know there are too many people running iOS 3 on the new iPhone, but if this happens, your UIImage needs to be pixelated on the retina iPhone Double the size for rendering to make up for the pixel density difference.
*Starting from iPhone 5, the size of the iPhone is now no longer standardized. Please use the appropriate API to retrieve the size of the screen or use layout constraints.< /p>
From UI Image Reference,
size
The dimensions of the image, taking orientation into account.
(read-only)
@property(nonatomic, readonly) CGSize size
Discussion
In iOS 4.0 and later, this value reflects the logical size of the image and is measured in points. In iOS 3.x and earlier, this value
always reflects the dimensions of the image measured in pixels.
What is the difference between pixels and dots?
The pixels on iOS are the full resolution of the device, which means that if my image length is 100×100 pixels, then the phone will be in the standard non-retina 100×100 pixels are rendered on the device. However, since newer iPhones have four times the pixel density, the same image will be rendered at 100×100 pixels, but it appears to be only half the size. A long time ago, iOS engineers were introducing Core Graphics The dot system solves this problem (in OS X using Quartz). Dots are standard length, equivalent to 1×1 pixels on non-retina devices, and 2×2 pixels on retina devices. In this way, your 100 ×100 images will be rendered twice the size on retina devices, and basically standardize what users see.
It also provides a standard measurement system on iOS devices, because regardless of the pixel density Change, there are always 320×480 dots on the iPhone screen, and 768×1024 dots on the iPad screen.*
But at the same time, considering that retina devices are introduced at least in iOS 4, you can basically Ignoring these documents, I don’t know that there are too many people running iOS 3 on the new iPhone, but if this happens, your UIImage needs to be rendered at twice the pixel size on the retina iPhone to make up for the pixel density difference .
*Since iPhone 5, the size of the iPhone is now no longer standardized. Please use the appropriate API to retrieve the size of the screen or use layout constraints.
p>