admin管理员组

文章数量:1317909

How is the right way to present the flutterViewController if the initial view controller ist another view controller (for example SplashViewController)?

I present the flutterViewController from the SplashViewController (rootViewController):

public class SplashViewController: UIViewController {

   public override func viewDidLoad() {
     super.viewDidLoad()

     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     let flutterEngine = appDelegate.flutterEngine
     let flutterViewController =
     FlutterViewController(engine: flutterEngine, nibName: nil, bundle: nil)
    
  
     flutterViewController.modalPresentationStyle = .overCurrentContext
     flutterViewController.isViewOpaque = false
     appDelegate.window?.rootViewController?.present(flutterViewController, animated: true, completion: nil)

This is working but the flutterViewController is now on the top of the stack of both viewControllers (1. SplashViewController, 2. FlutterViewController).

I ask me if this is the right way or if I have to dismiss the SplashViewController so that there are no problems with other ViewControllers such as MFMailComposeViewController if I open it later from my Flutter app.

Thanks for your help!

本文标签: swiftPresent flutterViewController and dismiss old rootViewControllerStack Overflow