我必须将导航栏标题的最后 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]
}
}