gpt4 book ai didi

iphone - 我可以只为我的 iPhone 应用程序使用 1 张图片吗?

转载 作者:行者123 更新时间:2023-11-28 23:10:31 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





loading logic of high resolution images by naming convention in iphone [closed]

(2 个回答)


8年前关闭。




因此,对于我以前的应用程序,每当我需要图像时,我都会使用其中的 2 个:

image.png & image@2x.png

它按预期工作,但我的情况是我只需要使用 1 个图像(一个只有 1 个图像 url 的 Web 服务调用)。如果我只使用高分辨率图像,它会缩小为低分辨率屏幕吗?任何意见,将不胜感激。

最佳答案

如果您使用 UIImageView 显示图像,则可以使用高分辨率版本并在适当时将内容模式设置为缩放。

例如,您希望图像为 100x100 点(200x200 像素视网膜)。从您的 Web 服务检索 200x200 像素版本后,执行以下操作:

UIImageView *myImageView = [[UIImageView alloc] initWithImage:myHighResImage];
myImageView.frame = CGRectMake(0.0f, 0.0f, 100.0f, 100.0f);
myImageView.contentMode = UIViewContentModeScaleAspectFit;

在非视网膜显示器上,图像将按比例缩小。在视网膜显示器上,它将按原样显示。

关于iphone - 我可以只为我的 iPhone 应用程序使用 1 张图片吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8424706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com