How to remove the default Navigation Bar space in SwiftUI NavigiationView

后端 未结 15 2766
我在风中等你
我在风中等你 2020-11-29 20:00

I am new to SwiftUI (like most people) and trying to figure out how to remove some whitespace above a List that I embedded in a NavigationView

In this image, you can

15条回答
  •  旧时难觅i
    2020-11-29 20:13

    My solution for this problem was the same as suggested by @Genki and @Frankenstein.

    I applied two modifiers to the inner list (NOT the NavigationView) to get rid of the spacing:

    .navigationBarTitle("", displayMode: .automatic)
    .navigationBarHidden(true) 
    

    On the outer NavigationView, then applied .navigationBarTitle("TITLE") to set the title.

提交回复
热议问题