Reputation: 51
I have navigation controller and tab bar controller. TBC is embeded in NC. When I present VC from another VC, I see only NC and not TBC there. I want them both to be presented. What should I do?
Here is my code:
let mainAreaVC = self.storyboard?.instantiateViewController(withIdentifier: "MainAreaVC") as! MainAreaVC
let mainAreaVCe = UINavigationController(rootViewController: mainAreaVC)
self.present(mainAreaVCe, animated: true, completion: nil)
Upvotes: 0
Views: 1765
Reputation: 72410
If you want to show MainAreaVC
with both NavigationController
and TabBarcontroller
then you need to present the UITabBarController
instead of MainAreaVC
. So in storyboard set the Storyboard Id
for your TabBarController
something like TabbarVC
or what ever you want then use it wit instantiateViewController
to get UITabBarController
.
let tabbarVC = self.storyboard?.instantiateViewController(withIdentifier: "TabbarVC") as! UITabBarController
self.present(tabbarVC, animated: true, completion: nil)
Upvotes: 1