ios - 如何从 native ios View 弹出回 flutter View ?

标签 ios xcode dart flutter storyboard

我正在向我现有的 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 and Routes. A Route is an abstraction for a “screen” or “page” of an app, and a Navigator is a widget that manages routes. A route roughly maps to a UIViewController. The navigator works in a similar way to the iOS UINavigationController, in that it can push() and pop() 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/

相关文章:

iphone - 如果 Controller 符合协议(protocol),那么它是否有必要为协议(protocol)的所有方法提供一个主体?

ios - 更改iOS 7中的引用计数?

xcode - 如何操作窗口中的底层 TextView ?

flutter - 根据键值之一从 map 中检索条目

dart - C# 的 Func<bool, String> 类型在 dart 中的等效项是什么,即如何声明强类型函数变量?

ios - 首次缩放时捏合放大不起作用 - ios

ios - 有什么方法可以在 iOS 中将音乐添加到 iPod 库?

swift - 如何消除导致此线程 1 : EXC_BAD_ACCESS error? 的错误

ios - 使用触控板在 TableView 上滚动

Flutter 在异步函数中调用 Navigator.pop