Reputation: 597
I am having trouble with 'MyTabBarController' being pushed too far off the screen. I have a normal View Controller, with a button that opens 'MyTabBarController', as essentially a popup over the screen. I have no problem with this code for a normal ViewController, but with a TabBarController + Embedded Nav Bar its causing some issues. The tabbar is also pushed off the bottom of the screen. Im sure it has something to do with the frame constraints, but not sure how because I have tried different tactics. The frame of the popup is equal to the frame of the previous view so I am a bit lost on what to do. If you need additional information let me know.
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier:
"MyTabBarController") as! MyTabBarController
self.addChild(vc)
vc.view.frame = self.view.frame
self.view.addSubview(vc.view)
vc.didMove(toParent: self)
Upvotes: 0
Views: 706
Reputation: 329
I think this will resolve the issue
vc.view.frame = self.view.safeAreaLayoutGuide.layoutFrame
Upvotes: 1