我正在SwiftUI中制作一个应用,并希望将导航栏标题文本的颜色更改为在资源文件夹中创建的自定义颜色。
我想将前景色设置为我的自定义“ jpurple”颜色。当我尝试实现它时,它不起作用:
init() {
UINavigationBar.appearance().largeTitleTextAttributes = [
.foregroundColor: Color("jpurple")]
}
这应该工作。
init() {
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor(named: "jpurple")]
}