有关运行 4.x 的旧手机上的视网膜显示资源的问题

发布于 2024-09-10 14:05:48 字数 162 浏览 0 评论 0原文

因此,我正在为 4.x 设备构建一个应用程序,我想知道是否可以只使用双分辨率的一组资源,而不是一组带有@2x id 和另一组没有@2x id。

基本上我问的是旧的 3g 和 3gs 可以只使用@2x 资产吗?并与他们一起做正确的事?

有人有这方面的经验吗?

谢谢

So I'm building an app for 4.x devices and I'm wondering if I can just use one set of assets at double resolution instead of one set with a @2x id and another set without.

Basically im asking can the older 3g and 3gs just use the @2x assets? and do the right thing with them?

anyone have experience with this?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

◇流星雨 2024-09-17 14:05:49

您最好使用两组资源,一组用于高分辨率视网膜显示器,一组用于较旧的显示器。缩小 @2x 图形尺寸看起来并不美观,并且会影响性​​能,尤其是在 2G iPod Touch 上。

较旧的设备可以使用@2x,但据我了解,您需要:

  1. 设置您的 UIImageViews 以缩放图像以适应。
  2. 将图像引用硬编码到新图像。
  3. 非视网膜设备上的图像质量较差且性能较慢。

总的来说,最好提供两个图像副本,"bob.png""[电子邮件受保护]",然后在代码中将它们引用为 "bob.png"

注意。从 iOS4 开始,您可以引用不带文件结尾的图像,因此只需 "bob" 即可;然而,这对运行 iOS4 之前版本的设备有兼容性影响:找不到图像。因此,为了获得最大兼容性,如果您打算部署到 iOS4 和 iOS3.x,请包含文件结尾。

You're better off using two sets of resources, one for the high resolution retina displays and one for the older displays. Downsizing @2x graphics won't look pretty and will impact performance, especially on 2G iPod Touches.

The older devices can use the @2x but as far as I understand you'll need to:

  1. Set your UIImageViews to scale the images to fit.
  2. Hardcode image references to the new images.
  3. Expect poor image quality and slower performance on non-retina devices.

Overall, it's better to provide two copies of the images, "bob.png" and "[email protected]" then reference them in code as "bob.png".

NB. As of iOS4 you can reference the images without their file endings, so just "bob" would work; however this has compatibility implications with devices running pre-iOS4 : the images won't be found. So for maximum compatibility include the file endings if you intend on deploying to both iOS4 and iOS3.x.

自控 2024-09-17 14:05:49

从技术上讲,他们可以,只要您确保它们以正确的方式缩放(例如,如果它是设置为放大/缩小的图像视图)。

然而,在大多数情况下不建议这样做,主要是因为它会更慢,使用更多资源,并导致电池寿命更短。此外,取决于您的资源,但缩小 2 倍的艺术品与专门针对新尺寸重新采样的艺术品的质量不同。

They technically can, given you make sure they're scaling the right way (e.g. if it's an image view that it's set to scale up/down).

However it's not recommended in most situations, mainly because it'll be slower, uses more resources, and leads to shorter battery life. Also, depends on your resources but an artwork scaled down by a factor of 2 doesn't have the same quality as one that is resampled specifically for the new size.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文