Ios ScrollView navigationlink在VStack和GeometryReader、XCode12、beta 4中仍处于活动状态
使用XCode12,Beta4,我试图分离一个标题区域和一个滚动视图。我试过VStack和GeometryReader;但是,当我在标题区域中单击时,它下面的ScrollView项目中的导航链接被触发 如果使用列表,则不会观察到这种不希望出现的行为。如果我在XCode 11.6中使用ScrollView并为iOS13构建,也不会观察到这种不希望出现的行为 VSTACK中的ScrollView或iOS14中的GeometryReaders是否有更改?为什么scrollview会在VStack或GeometryReader中的对象下“滑动”Ios ScrollView navigationlink在VStack和GeometryReader、XCode12、beta 4中仍处于活动状态,ios,swiftui,swiftui-navigationlink,Ios,Swiftui,Swiftui Navigationlink,使用XCode12,Beta4,我试图分离一个标题区域和一个滚动视图。我试过VStack和GeometryReader;但是,当我在标题区域中单击时,它下面的ScrollView项目中的导航链接被触发 如果使用列表,则不会观察到这种不希望出现的行为。如果我在XCode 11.6中使用ScrollView并为iOS13构建,也不会观察到这种不希望出现的行为 VSTACK中的ScrollView或iOS14中的GeometryReaders是否有更改?为什么scrollview会在VStack或Ge
struct ContentView: View {
var body: some View {
NavigationView{
//GeometryReader { geo in
VStack{
VStack{
Text("Blah")
}//.frame(height: geo.size.height*0.20)
VStack {
ScrollView {
ForEach(0..<10) { i in
NavigationLink(destination: Text("\(i)")) {
cardRow(i: i)
.frame(maxWidth: .infinity)
.foregroundColor(Color(UIColor.label))
.padding()
.background(RoundedRectangle(cornerRadius: 12))
.foregroundColor(Color(UIColor.secondarySystemFill))
.padding()
}
}
}
}//.frame(height: geo.size.height*0.90)
}
}.navigationViewStyle(StackNavigationViewStyle())
}
struct cardRow: View {
var i: Int
var body: some View {
HStack {
VStack {
Text("88")
}.hidden()
.overlay(
VStack{
Text("\(i)")
}
)
Divider()
.background(Color(UIColor.label))
Spacer()
}
}
}
}
struct ContentView:View{
var body:一些观点{
导航视图{
//GeometryReader{geo-in
VStack{
VStack{
文本(“废话”)
}//.框架(高度:地理尺寸高度*0.20)
VStack{
滚动视图{
ForEach(0..这里是工作解决方案(使用Xcode 12/iOS 14测试)
VStack{
滚动视图{
ForEach(0..谢谢!但是为什么我们现在需要剪辑ScrollView?发生了什么变化或者是一个bug…我们不得不担心ScrollView和堆栈中其他项之间的重叠和交互,这似乎违反了直觉。
VStack {
ScrollView {
ForEach(0..<10) { i in
NavigationLink(destination: Text("\(i)")) {
cardRow(i: i)
.frame(maxWidth: .infinity)
.foregroundColor(Color(UIColor.label))
.padding()
.background(RoundedRectangle(cornerRadius: 12))
.foregroundColor(Color(UIColor.secondarySystemFill))
.padding()
}
}
}.clipped().contentShape(Rectangle()) // << here !!
}