【问题标题】:Cannot convert value of type 'Color' to expected argument type 'UIColor?' [duplicate]无法将“颜色”类型的值转换为预期的参数类型“UIColor?” [复制]
【发布时间】:2021-07-06 22:05:36
【问题描述】:

大家好,我正在尝试在名为“tint”的资产文件中创建一个具有十六进制颜色的导航栏,但出现此错误“无法将 'Color' 类型的值转换为预期的参数类型 'UIColor?

.navigationBarColor(Color("tint"))

【问题讨论】:

标签: ios swiftui navbar uicolor


【解决方案1】:

只需使用该颜色创建新的UIColor

navigationBarColor(UIColor(Color("tint")))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-13
    • 2016-07-27
    • 2016-07-02
    • 2016-03-21
    • 1970-01-01
    • 2020-03-01
    • 2016-08-01
    • 2017-02-07
    相关资源
    最近更新 更多