ios - 为什么 iOS 中的 slider 最小值图像变得模糊?

标签 ios uislider

我为这个 slider 的 minimumValueImage 和 maximumValueImage 使用 24x24 点 png 图像,但是当我在 iPhone 模拟器上运行它们时,它看起来很模糊/拉伸(stretch)。谁能帮我解决这个问题。

enter image description here

最佳答案

存在三种可能的屏幕分辨率,因此您应用中的每张图片都需要提供三种版本。方法如下:

  1. 制作三种尺寸的三张图片:在您的情况下,将是 24x24、48x48、72x72。

  2. 编辑 Assets 目录。创建图像集。为图像集命名。

  3. 选择图像集。您将看到带有三个图像插槽的通用显示器:

    enter image description here

  4. 将小图拖入 1x 槽,将中图拖入 2x 槽,将大图拖入 3x 槽。

  5. 在您的代码中,通过图像集的名称引用图像。

按照这些说明您应用中的每张图片

关于ios - 为什么 iOS 中的 slider 最小值图像变得模糊?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41487879/

相关文章:

java - iOS : Write ByteArray ( [Int8] ) to a file in swift 4

objective-c - 这两个main.m有什么区别?

ios - CLLocationManager 不要停止

ios - 使用 Swift 和 Alamofire 的 JSON 结构

ios - iOS slider 的默认缩略图大小?

javascript - 从 jQuery 1.9.1 迁移到 1.10.1 导致错误 : Object has no method

ios - JASidePanels 示例 2 使用 Storyboard : crash

ios - UISlider 添加到 UITableViewCell 奇怪的行为

ios - 为什么不设置此 UISlider 的值属性更新其位置?

ios - 为什么 UITextView 在调整大小后在错误的框架中绘制文本?