-(void)test01{
//创建FlutterViewController
FlutterViewController* flutterViewController = [[FlutterViewController alloc] init];
self.fc = flutterViewController;
//添加进view
[self.view addSubview:flutterViewController.view];
flutterViewController.view.frame = CGRectMake(0, 60, 310, 600);
}
注意一点 此时flutter解释器获取不到view的状态变化
需要手动调用FlutterViewController 的相关方法 通知flutter解释器
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.fc viewWillAppear:animated];
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[self.fc viewDidAppear:animated];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[self.fc viewWillDisappear:animated];
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[self.fc viewDidDisappear:animated];
}