I have a HomeView
NavigationView {
ZStack {
VStack {
NavigationLink(destination: ProfileView()) {
if session.userInSession?.activated != 1 {
completionText(message: "Complete Your Profile")
} else {
completionText(message: "Edit Your Profile")
}
}
}
}
}
My ProfileView
is not wrapped in a navigation view nor has a bar title:
VStack {
ScrollView(showsIndicators: false) {
...
}
}
But my ProfileView
is also accessible from my SettingView
NavigationView {
VStack(alignment: .leading) {
List {
NavigationLink(destination: ProfileView()) {
}
}
}
}
When I access my ProfileView
from the setting screen, it displays fine. But when I access it from my HomeView
it creates white space at the top:
When I go through Settings its fine:
How can I remove this white space above?
It looks like your HomeView
/s NavigationView
has .navigationBarTitleDisplayMode(.large)
or automatic, which is by default .large
, but your SettingView
has .navigationBarTitleDisplayMode(.inline)
(taking into account divider below < Setting
), so you see different height of title bars.
Of course it is assumption due not absent of detailed code, but possible solution to make it same would be add explicit mode for ProfileView
, eg:
VStack {
ScrollView(showsIndicators: false) {
}
}.navigationBarTitleDisplayMode(.inline) // << here !!