1

I have two texts that I would like to display in a navigation title:

...
        .navigationTitle(Text(getTitle()) + Text(" (\(selection + 1)/\(sequenceObject.homeElements.count))"))

However, the first text could become too large after user input and the second text would no longer be displayed (

This is a verly long navigation ti...

). But the second text must always be visible!!! My wish text layout of the navigation title would be:

This is a very long...second text

Any ideas?😃

Best regards!

1 Answer 1

0

You need to do it a little bit different. .navigationTitle is not made for a long title, but if you do need a long title, use the Text modifier like this:

NavigationView{
            VStack(){
                //"your Code
            }
            .navigationBarTitleDisplayMode(.large)
            .toolbar {
                ToolbarItem(placement: .navigationBarLeading) {
                    VStack {
                        Text("This is a very long title").font(.largeTitle).bold()
                        Text("with our subtitle").font(.subheadline)
                        //you can also do .font(.largeTitle).bold() here
                    }
                }
            }
        }
Sign up to request clarification or add additional context in comments.

1 Comment

Hey. Thank you really much! Unfortunately I need a large naviagtion title (.navigationbardisplaymode(.large)) and thats why this wouldn´t work for me..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.