为什么UIImage的属性尺寸是真实图片尺寸的一半?

Why the property Size of UIImage is half of the real picture size?

我有一张268*381的图片名为pic, 我已经定义

UIImage* tempImg = [UIImage imageNamed:@"pic"];

但是当我打印

NSStringFromCGSize(tempImg.size)

显示{134, 190.5}

这个原理看不懂,求解答者万分感谢!

来自 UIImage size 的文档:

In iOS 4.0 and later, this value reflects the logical size of the image and is measured in points

请记住,像素等于点乘以比例。或者点是像素除以比例。

您的 268x381 大小以像素为单位。 NSStringFromCGSize(tempImg.size) 的输出以点为单位。 {134, 190.5} 的结果意味着这是一张比例为 2 的图像。很可能您将此图像设为 pic@2x.png