假设要在SwiftUI中显示详细视图时隐藏标签栏的问题

时间:2020-03-01 02:27:14

标签: listview navigation swiftui

我能够成功隐藏标签栏,但是从屏幕截图中可以看出,我留下了详细视图的底部,灰色的部分会在与屏幕交互时消失。

enter image description here

enter image description here

在显示以下代码片段的详细信息视图时,我可以通过切换bool变量来实现上述结果:

.onAppear{
    self.displayDetails.showFullScreen.toggle()
}

,当用户单击“后退”按钮时,将切换切换并再次显示选项卡。

有没有人知道a在首次显示时或用户与屏幕交互时如何删除详细视图底部的灰色区域!?

更新: 在我的AppView视图中,我有以下代码:

...
var body: some View {

    VStack {

        containedView()

        // **** Hide the Tab Bar ***
        if (!displayDetails.showFullScreen) {

            ZStack(alignment: .top) {

                BottomBar(selected: self.$selected)
                    .padding()
                    .padding(.horizontal, 22)
                    .background(CurvedShape())


                Button(action: {

                }) {

                    Image(systemName: "plus")
                        .renderingMode(.original)
                        .aspectRatio(contentMode: .fit)
                        .frame(width: 55, height: 55)

                }.background(Color.blue)
                    .clipShape(Circle())
                    .offset(y: -25)
                    .shadow(radius: 5)

            }.background(Color("Color").edgesIgnoringSafeArea(.top))

        }

    }

}

如您所见,当用户单击“列表”视图中的“列表”项之一时,if子句将删除选项卡并使containedView()可见。

0 个答案:

没有答案