如何在navigationView.When中删除navigationBar我在另一个导航中使用导航视图查看它显示另一个导航栏并从navigationBar.How中放置空格可以解决这个问题吗?我尝试使用navigationBarHidden或NavigationBarTitle (显示模式:.inline),但当我为一个NavigationView使用时,它不工作,但在另一个navigationView中,它不工作。
struct ShowCaseView : View {
var productList = ShowCaseViewModel()
@State var cancellable = Set<AnyCancellable>()
@State var productListData : ShowCaseDataResponse?
@State var isAnimating : Bool = true
@State var showCaseData : [ShowCaseData] = []
@State var isOpened : Bool = true
var body: some View {
ZStack{
NavigationView{
ScrollView {
VStack {
if productListData?.success == true {
ForEach(showCaseData , id:\.id) { data in
if data.isHeaderVisible == true {
Text(data.name ?? "")
.font(.system(size: 18))
.bold()
}
ListTypeShow(data: data)
}
}
}
}
}.navigationBarTitle("",displayMode: .inline)
ActivityIndicator(isAnimating: $isAnimating)
}
.onAppear {
if isOpened == true {
getStoreIndex()
}
}
}


发布于 2021-01-04 20:42:37
如果ShowCaseView的父视图已经有了NavigationView,那么在ShowCaseView中就不需要另一个了。
struct ShowCaseView : View {
var productList = ShowCaseViewModel()
@State var cancellable = Set<AnyCancellable>()
@State var productListData : ShowCaseDataResponse?
@State var isAnimating : Bool = true
@State var showCaseData : [ShowCaseData] = []
@State var isOpened : Bool = true
var body: some View {
ZStack{
// NavigationView{ // << remove this one !!https://stackoverflow.com/questions/65562718
复制相似问题