简体   繁体   English

SwiftUI 删除 NavigationView 表单中的空白行

[英]SwiftUI remove blank line in NavigationView Form

I would like to remove a blank line which appears between my top title and my form.我想删除出现在我的顶部标题和表单之间的空白行。 I have tried different methods without success.我尝试了不同的方法但没有成功。

Blank line between title and form标题和表格之间的空行

   var body: some View {
            NavigationView{
                VStack{
                    ZStack{
                        Color(UIColor.lightGray).edgesIgnoringSafeArea(.all)
  VStack(alignment: .center){
                Text("Mon Parcours").font(.title).bold().padding(.top, 80).opacity(0.5).shadow(color: Color(UIColor.darkGray), radius: 1, x: 2, y: 2)
                }
                HStack{
                Spacer()
                    NavigationLink(destination: NoteInfoView()) {
                    Image(systemName: "questionmark.circle").foregroundColor(.blue).padding(.top, 80).padding(.trailing, 10)
                    }}
            }.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 160, alignment: .topLeading).padding(.bottom,0)

            VStack(alignment: .leading) {
                Form{
                    Section(header: Text("TYPE DE BAC").bold()){
                        NavigationLink(destination: ListSpecialiteView(bacData:self.bacData, specialiteId:1)) {
                            HStack{
                                Text(self.bacData.selectionTypeBacId).font(.body).lineLimit(1).truncationMode(.tail)
                                Spacer()
                                Image(systemName:"r.square").resizable().frame(width: 20.0, height: 20.0).foregroundColor(.green)
                                }
                            }
                    }
                }
            }
        }.navigationBarTitle("").navigationBarHidden(true).statusBar(hidden: false)         }.edgesIgnoringSafeArea(.top)
}

For the first VStack try VStack(alignment: .center, spacing: 0) , VStack and HStack is adding a space between components对于第一个VStack尝试VStack(alignment: .center, spacing: 0)VStackHStack在组件之间添加一个空间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM