在子视图中显示ActionSheet,Popover或Sheet的SwiftUI NavigationView关闭了子视图

时间:2020-09-15 08:00:36

标签: ios swiftui ipados

在iPad上,当我以与以下类似的样式呈现导航层次结构时:

        NavigationView {
            NavigationLink(destination: Text("Hi").actionSheet(isPresented: .constant(true)) { () -> ActionSheet in
                ActionSheet(title: Text("welllllll"))
            },
                           tag: true,
                           selection: $didNavigateToChild) {
                            Button(action: {
                                self.didNavigateToChild = true
                            }) {
                                Text("Let's go!")
                            }
            }
        }
        .navigationViewStyle(StackNavigationViewStyle())

在显示弹出框,操作表或工作表时(在本例中为带有文本“ welllllll”的ActionSheet),子视图被关闭了(Text("Hi")),我最终回到Text("Let's go!")

我一直试图了解所谓的解雇,但我是SwiftUI的新手,而我以前的符号断点使我失望了。

无论出于何种原因,这仅在iPad上发生。在iPhone上显示ActionSheetSheet的子NavigationView public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader sum = new BufferedReader(new InputStreamReader(System.in)); double a; a = Double.parseDouble(sum.readLine()); while(true) { calcYellow(a, a); break;} while(true) { calcRed(a, a); break;} while(true) { calcGreen(a, a, a, a); break;} } static void calcYellow(double a, double b) { double a1 = 3.0; double b1 = 3.5; for (a=a1+4; a<60; a++); for (b=b1+4; b<60; b++); if ((a%3.0==0) || (a%3.5==0)); if ((b%3.0==0) || (b%3.5==0)); System.out.println("Yellow"); } static void calcRed(double a, double b) { double a1 = 4.0; double b1 = 4.5; for (a=a1+4; a<60; a++); for (b=b1+4; b<60; b++); if ((a%4.0==0) && (a%4.5==0)); if ((b%4.0==0) && (b%4.5==0)); System.out.println("Red"); } static void calcGreen(double a, double b, double c, double d) { double a1 = 1.0; double b1 = 1.5; double c1 = 2.0; double d1 = 2.5; for (a=a1+4; a<60; a++); for (b=b1+4; b<60; b++); for (c=c1+4; c<60; c++); for (d=d1+4; d<60; d++); System.out.println("Green"); } } 效果很好,而没有任何奇怪的导航副作用。

0 个答案:

没有答案