Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios ScrollView navigationlink在VStack和GeometryReader、XCode12、beta 4中仍处于活动状态_Ios_Swiftui_Swiftui Navigationlink - Fatal编程技术网

Ios ScrollView navigationlink在VStack和GeometryReader、XCode12、beta 4中仍处于活动状态

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

使用XCode12,Beta4,我试图分离一个标题区域和一个滚动视图。我试过VStack和GeometryReader;但是,当我在标题区域中单击时,它下面的ScrollView项目中的导航链接被触发

如果使用列表,则不会观察到这种不希望出现的行为。如果我在XCode 11.6中使用ScrollView并为iOS13构建,也不会观察到这种不希望出现的行为

VSTACK中的ScrollView或iOS14中的GeometryReaders是否有更改?为什么scrollview会在VStack或GeometryReader中的对象下“滑动”

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 !!
  }