我正在尝试在下面的代码中使用NavigationView
和NavigationLink
。听说NavigationLink
只在里面有效NavigationView
。但是,每当我将我的嵌入ScrollView
到 aNavigationView
中时,scrollView 就会停止显示并且我得到一个空白区域。我不确定它背后的原因是什么。
var body: some View {
// I tried to embed the entire VStack into NaviationView. However, it ends up showing nothing as well
VStack(alignment: .leading) {
Text(self.categoryName)
.font(.title)
NavigationView {
ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .top) {
ForEach (self.drummers) { drummer in
NavigationLink("Moreinfo", destination: drummerDetail(drummer: drummer))
aDrummer(drummer: drummer)
.frame(width: 300)
.padding(.trailing, 30)
}
}
}
.padding()
}
}
}