gpt4 book ai didi

ios - 如何减小 UI 选项卡栏项目图像的大小以使其适合选项卡栏?

转载 作者:搜寻专家 更新时间:2023-10-31 08:18:54 24 4
gpt4 key购买 nike

这是一个 iPhone 应用程序的标签栏,使用 Xcode 6.3 中的 Swift 编码语言

我的问题是我想在我的一个 View Controller 的选项卡栏中添加一张图片,但图片太大了。我最初的解决方案是使用预览手动减小图像的大小,但这样做后分辨率很差。是否有一行代码可以放入应用程序委托(delegate)中,在不更改源文件的情况下调整图像大小?有谁知道解决这个问题的其他方法吗?

The picture of the manually sized, low resolution image

The picture of the original, full resolution image, that is oversized

第二张图片是目标,但没有分辨率损失。

最佳答案

这是不可能的。

检查 Icon and Image Sizes guidelines来自苹果。它明确提到:

Unlike other custom artwork in your app, the icons and images listed in Table 41-1 must meet specific criteria so that iOS can display them properly.

这也适用于标签栏图标。因此,如果您的图像大于最大尺寸(在上面的链接中提到),您将面临此类问题。更好地调整图像大小。

如果您担心视网膜显示器(6、6+ 等)分辨率不佳,请确保为每个标签栏图像提供 @2x 和 @3x 图像到 Support the Retina display .

关于ios - 如何减小 UI 选项卡栏项目图像的大小以使其适合选项卡栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29708069/

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