SwiftUI multiline text in a NavigationView Title

前端 未结 1 1631
既然无缘
既然无缘 2021-01-18 18:46

How could I make this title multiline?

I have tried setting the title text as multiline or even configuring it with allowsThigtening(flag: Bool) but none of

相关标签:
1条回答
  • 2021-01-18 19:20

    As Asperi has said, it is not possible to have a multiline navbar title by default. So, following Asperi suggestion, I have hidden the default title and I have set a custom Text():

    VStack(alignment: .leading) {
                        Text(Constants.Distribution.text)
                        .font(.system(size: 34, weight: .heavy))
                        .foregroundColor(Color.white)
                    }
    

    . . .

    .navigationBarTitle(Text(""), displayMode: .inline)
    
    0 讨论(0)
提交回复
热议问题