How can I add a subtitle under a large title that was defined this way?
NavigationView{
VStack(){
//"Some code"
}
.navigationTitle("Analytics")
}
How can I add a subtitle under a large title that was defined this way?
NavigationView{
VStack(){
//"Some code"
}
.navigationTitle("Analytics")
}
You could try something like this:
NavigationView{
VStack(){
//"Some code"
}
.navigationBarTitleDisplayMode(.large)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
VStack {
Text("Title").font(.largeTitle).bold()
Text("Subtitle").font(.subheadline)
}
}
}
}
Seems "navigationSubtitle" is only for macos, this is another way to do it in ios:
.navigationBarItems(leading: VStack {
Text("Analytics").font(.largeTitle).bold()
Text("Subtitle")
})
Edit update:
you could also try this, with some loss of font choice:
.navigationTitle("Subtitle")
.navigationBarItems(leading: Text("Analytics").font(.largeTitle).bold())
I have found a solution to what I was looking for: basically create the top of the screen as it would normally be without a navigationView and then add a scrollview underneath.
HStack {
VStack(alignment: .leading, spacing: 5) {
Text("Title")
.font(.largeTitle)
.foregroundColor(Color(UIColor.label))
.fontWeight(.bold)
Text("subtitle")
.font(.subheadline)
.foregroundColor(Color(UIColor.label))
}
Spacer()
}
.padding()
ScrollView(.vertical, showsIndicators: false) {}