SwiftUI在NavigationView表单中删除空白行

时间:2019-10-17 12:37:03

标签: forms swiftui navigationview

我想删除在我的头衔和表格之间出现的空白行。 我尝试了不同的方法,但没有成功。

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)
}

1 个答案:

答案 0 :(得分:0)

对于第一个VStack,请尝试VStack(alignment: .center, spacing: 0)VStackHStack在组件之间添加空格