I'm trying to add an UIViewController
as child view controller to the tab bar controller. See code below:
guard let vc = self.storyboard?.instantiateViewController(withIdentifier: "MyAlertViewController") as? MyAlertViewController else
{
return
}
let base: UITabBarController = tabBarController!
base.addChildViewController(vc)
vc.view.frame = base.view.bounds
base.view.addSubview(vc.view)
vc.didMove(toParentViewController: base)
It works, but there is an issue that I'm unable to solve: MyAlertViewController
is added to tab bar controller's viewControllers
array, and sometimes it is even shown as a tab bar item. Is there a way to solve this? Thanks.