iOS,支持视网膜显示

iOS, support retina display

当支持 Retina 和非 Retina 显示器时,您将提供 image.pngimage@X2.png 以及相关的分辨率。

我了解 iOS 将根据用户的设备决定使用哪个图像。但是,我是通过代码而不是情节提要来使用图像的。

self.imagePortrait = [UIImage imageNamed:@"image.png"];

即使我没有指定 image@X2.png,iOS 会使用它吗?

在这种情况下是的。 UIImage 的 -imageNamed: 足够聪明,可以选择正确的资源。 (注意后缀是@2x,不是@X2。)

From the docs:

If the screen has a scale of 2.0, this method first searches for an image file with the same filename with an @2x suffix appended to it.

其他方法(如 -initWithContentsOfFile:)没有内置这些​​智能。