【发布时间】:2014-12-31 03:44:20
【问题描述】:
有人可以举个例子,在 Xcode 上使用 Vector image (.pdf) 选项 Render: "as template" in the image.xcasset? 我可以以编程方式设置矢量图像的颜色吗?如果是怎么办?
谢谢, 奥马尔。
【问题讨论】:
有人可以举个例子,在 Xcode 上使用 Vector image (.pdf) 选项 Render: "as template" in the image.xcasset? 我可以以编程方式设置矢量图像的颜色吗?如果是怎么办?
谢谢, 奥马尔。
【问题讨论】:
是的,你可以。使用“作为模板”时,系统会忽略图像的颜色信息,并根据图像中的 alpha 值创建图像模板(alpha 值小于 1.0 的图像部分被视为完全透明)。然后可以使用 tintColor 重新着色此模板,以匹配您的用户界面的其余部分。
见Apple documentation about template images in UIKitUICatalog。
【讨论】: