HomeiOS DevelopmentSetting largeSubtitleTextAttributes would not do something

Setting largeSubtitleTextAttributes would not do something


I’m attempting to customise my navigation title and subtitle in iOS 26. Nevertheless it looks as if setting largeSubtitleTextAttributes on UINavigationBarAppearance would not appear to do something.

So for a view with one thing like this:

NavigationStack {
    // content material
    .navigationTitle("Title")
    .navigationSubtitle("Subtitle")
}

I’m setting the looks:

let look = UINavigationBarAppearance()

// Giant title
look.largeTitleTextAttributes = [.foregroundColor: UIColor.green]
look.largeSubtitleTextAttributes = [.foregroundColor: UIColor.yellow]

// Inline title
look.titleTextAttributes = [.foregroundColor: UIColor.blue]
look.subtitleTextAttributes = [.foregroundColor: UIColor.red]
        
let navAppearance = UINavigationBar.look()
navAppearance.standardAppearance = look
Giant Inline
Setting largeSubtitleTextAttributes would not do something inline

Right here we will see that after we scroll, the title shrinks to the inline model, and the colour adjustments from inexperienced to blue. However the subtitle is pink all the time. If I take away the subtitleTextAttributes, then the subtitle is the default shade in each circumstances.

Is it is a bug with UINavigationBarAppearance Or am I doing one thing improper? I’ve tried with each a SwiftUI view in a NavigationStack and a UIKit view in a UINavigationController, and the habits is similar.

I’ve been in a position to get this to work with UIKit utilizing navigationItem.attributedSubtitle and navigationItem.largeAttributedSubtitle, and it switches between each appropriately. However clearly I am unable to do the identical in SwiftUI.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments