我正在向我现有的 flutter up 添加一个带有 Storyboard的新 View 。然后推它。 Root View 是 flutter View ,所以我可以在原生 ios View 打开时弹出。
如何从我的 Root View (flutter View )使用相同的 UINavigationController 从 native ios View 弹出回到我的 flutter View ?
这是我的 flutterchannelmanager swift 文件中的代码,用于将它与 appdelegate 分开。
self.storyVC = UIStoryboard(name: "StripePayment", bundle: nil)
let stripeVC: StripeViewController = self.storyVC!.instantiateViewController(withIdentifier: "stripe_payment") as! StripeViewController
self.flutterViewController.present(mynavigationController, animated: true, completion: nil)
最佳答案
这包含在 documentation 中:
In iOS, to travel between view controllers, you can use a
UINavigationController
that manages the stack of view controllers to display.Flutter has a similar implementation, using a
Navigator
andRoutes
. ARoute
is an abstraction for a “screen” or “page” of an app, and aNavigator
is a widget that manages routes. A route roughly maps to aUIViewController
. The navigator works in a similar way to the iOSUINavigationController
, in that it canpush()
andpop()
routes depending on whether you want to navigate to, or back from, a view.
我建议查看示例以获取有关实现的更多详细信息。另外,您可以查看 this blog以便更好地理解使用 Coordinator 模式在 Flutter 页面和 native iOS 页面之间导航。
关于ios - 如何从 native ios View 弹出回 flutter View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53994208/