【发布时间】:2020-11-19 15:29:33
【问题描述】:
在我的 GeneralView 中,我有一个 NavigationView 和一个 Tab View。 在每个 tabItem 中,我使用一些 ZStack 进行导航(使用 zIndex,隐藏和显示项目)
随机前导和尾随项目未正确显示且无法单击。 见下文,屏幕顶部的后退按钮未满。但我选择相同的按钮继续“Coureur1View” 信息:我对这个导航没有任何其他问题。
在我的一般视图中:
.toolbar {
ToolbarItemGroup(placement: .principal) {
TitleBarView().environmentObject(objCourse)
}}
.navigationBarItems(leading: TitleBarLeadingView(),
trailing: TitleBarTrailingView())
TitleBarView(原则)没有问题,但前导和尾随 在我的 TitleBarLeadingView 中:
struct TitleBarLeadingView: View {
@EnvironmentObject var objGroupe : GroupeActuel
@EnvironmentObject var objCourse : CourseActuelle
@EnvironmentObject var zindex : Zindex
var body: some View {
HStack {
if zindex.selectedTab > 0 {
if zindex.detailCoureurVisible {
Button{
zindex.detailCoureurVisible = false
} label : {
Image(systemName: "chevron.backward")
Text("Back")
}.foregroundColor(.orange)
}else{
EmptyView()
}else{
EmptyView()
}
}
}
【问题讨论】: