我有一个 64 像素 x 64 像素的 redSquare.png 文件,分辨率为 326ppi。我将它绘制在我的视图控制器窗口的左上角,如下所示:
myImage = [UIImage imageNamed:@"redSquare.png"];
myImageView = [[UIImageView alloc] initWithImage:myImage];
[self.view addSubview:myImageView];
鉴于 iPhone 4S 的屏幕分辨率为 960x640 (326ppi),应该有足够的空间容纳 9 个以上的正方形,以便在第一个正方形旁边放置。然而,只有 4 个以上的空间。即正方形画得比我的测量值要大。
// even tried resizing UIImageView in case it was
// resizing my image to a different size, by adding
// this next line, but no success there either :
myImageView.frame = CGRectMake(0, 0, 64, 64);
我相信这与设备“翻译”我的像素的方式有关。我在 Apple 的文档中读到了点与像素之间的区别,但它没有提到如何解决这个问题。我知道我以像素为单位进行测量。我应该用点来衡量吗?我怎么能这样做?我究竟如何调整我的图像大小,以便它可以在它旁边再容纳 9 个相同大小的正方形(即在同一水平线上..)?
谢谢