【发布时间】:2021-10-12 22:05:05
【问题描述】:
我有一个自定义 SF Symbol,当在 SF Symbols 3 应用程序中查看时,它会呈现分层阴影,但在使用 SwiftUI 的 iOS 中,它呈现为单色。
这是 SF Symbols 3 应用程序中的符号:
这是在资产目录中作为 3.0 模板导入的符号:
这里是渲染它的代码:
Image("custom.figure.steps")
.font(.largeTitle)
.padding(.trailing)
.symbolRenderingMode(.hierarchical)
.foregroundColor(status.statusColor)
这是它在 iOS 模拟器中的呈现方式:
如何获得分层阴影?
【问题讨论】:
-
你试过用标准系统颜色渲染它吗?我们不知道您的
status.statusColor是什么。 -
刚刚尝试使用
Color(uiColor: .systemRed)和Color(uiColor: .systemGray)并且仍然呈现为单色。 -
另外,您需要显示您在 SF Symbols 中设置的图层。
-
@Yrb 已编辑以包含符号图层。
-
您是否将其导出为 3.0 模板以导入 Xcode?span>
标签: ios swift swiftui sf-symbols