Flutter和iOS本机页面相互跳转

时间:2019-03-25 08:41:07

标签: ios flutter

不好意思,这是带有导航栏的iOS扑跳iOS的本机页面,返回到扑出页面时遇到了问题。 跳转逻辑:

if ([@"jumpToiOSNativePages" isEqualToString:call.method] ) {

   NativeViewController *vc = [[NativeViewController alloc] init];

   FlutterViewController* controller = (FlutterViewController*) [UIApplication sharedApplication].keyWindow.rootViewController;

   UINavigationController *chatNav = [[UINavigationController alloc] init];

   controller.view.window.rootViewController = chatNav;

   [chatNav pushViewController:vc animated:YES];

}

然后,NativeViewController单击时:

 (void)leftbackOnClick {
    [self.navigationController popViewControllerAnimated:YES];
 }

但这不起作用。

1 个答案:

答案 0 :(得分:0)

    NativeViewController *vc = [[NativeViewController alloc] init];

    UINavigationController *chatNav = [[UINavigationController alloc] initWithRootViewController:vc];

    vc.mainVC = (FlutterViewController *)[UIApplication sharedApplication].keyWindow.rootViewController;

    [UIApplication sharedApplication].keyWindow.rootViewController = chatNav;

在NativeViewController.h类中添加@property(非原子的,强壮的)FlutterViewController * mainVC; 退货时设置: [UIApplication sharedApplication] .keyWindow.rootViewController = self.mainVC;