使用素材资源中的颜色设置更改导航栏标题索引颜色

问题描述

我必须将导航栏标题的最后5个字母更改为资产中的颜色。

struct MainView: View {
    var body: some View {
        NavigationView {
            Text("Hello,World!")
            
            .navigationBarTitle("HelloWorld")
        }
    }
    
    init() {
        // UIColor.red should be Color("orange1") and only for the last 5 letters (World)
        UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.red]
        UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: UIColor.red]
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)