【问题标题】:Using Vectors on image xcasset Xcode and Render as Template在图像 xcasset Xcode 上使用向量并渲染为模板
【发布时间】:2014-12-31 03:44:20
【问题描述】:

有人可以举个例子,在 Xcode 上使用 Vector image (.pdf) 选项 Render: "as template" in the image.xcasset? 我可以以编程方式设置矢量图像的颜色吗?如果是怎么办?

谢谢, 奥马尔。

【问题讨论】:

    标签: ios xcode vector xcasset


    【解决方案1】:

    是的,你可以。使用“作为模板”时,系统会忽略图像的颜色信息,并根据图像中的 alpha 值创建图像模板(alpha 值小于 1.0 的图像部分被视为完全透明)。然后可以使用 tintColor 重新着色此模板,以匹配您的用户界面的其余部分。

    Apple documentation about template images in UIKitUICatalog

    【讨论】:

    • 谢谢@Ludovic,它在 iOS8 中工作。在 iOS7 中处理图像和按钮有点棘手。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-25
    • 2017-04-26
    • 1970-01-01
    • 2021-03-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多