TabViewController是黑切换标签并呈现后模态的ViewController [重复]

问题描述 投票:0回答:1

我有一个的UITabBarController和需要显示的TabBar所有的时间。在一个视图控制器,其代表一个选项卡,我提出其他Viewcontrollers与childViewController.modalPresentationStyle = .overCurrentContext。当我提出一个ChildViewController(UIViewControllerA0,..),我显示的导航栏。要回去,我解雇currentChildViewController。

这工作得很好,但下面的步骤结束了黑屏。

  1. 在选择的TabBar UIViewControllerA
  2. 点击UIViewControllerA和现在的东西(UIViewControllerA0)
  3. UIViewController中0显示与导航栏回去
  4. 切换到标签UIViewControllerC或乙
  5. 切换到标签UIViewControllerA - >儿童UIViewControllerA0仍然可用
  6. 回到上导航栏和罢免UIViewControllerA0
  7. UIViewControllerA是黑色<--- ERROR
  8. 切换到标签UIViewControllerB或C,然后再返回 - > UIViewControllerA示出正确

我UIStructure是

UITabBarController
|-UINavigationController
|   --UIViewControllerA Tab
|      --UIViewControllerA0
|      --UIViewControllerA1
|   
|--UINavigationController
|   --UIViewControllerB Tab
|      --UIViewControllerB0
|      --UIViewControllerB1
|
|--UINavigationController
|   --UIViewControllerC Tab
|      --UIViewControllerC0
|      --UIViewControllerC1
|

我尝试了好几种presentationStyles,但我需要显示的TabBar呈现出“ChildViewController”的时候。我也试图以某种方式重新加载视图控制器,但是失败了,我认为这是不正确的方法。

是否有一个解决方案,或只是不可能使用这样的TabNavigation?

亲切的问候

ios swift uiviewcontroller uitabbarcontroller uitabbar
1个回答
0
投票

好吧那怪异的,这是presentationContext和PresentationStyle我开始组合,但我再次尝试四周,设置回“开始”,现在,它具有以下设置工作:

在UIViewControllerA例如呈现儿童时

childViewController.modalPresentationStyle = .overCurrentContext self.definesPresentationContext = true self.present(childViewController, animated: true, completion: nil)

关闭ChildViewController我打电话时

childViewController.dismiss(animated: true) {}

我现在可以留在ChildViewController一个标签上,制表符和其它选项卡甚至开放其他ChildViewControllers和关闭ChildViewController时显示正确的ViewController(UIViewControllerA,UIViewControllerB或UIViewControllerC)之间切换

我现在花在这个小时,现在看来是那么容易,因为它可能是...

© www.soinside.com 2019 - 2024. All rights reserved.