DEV Community

Alberto Giambone
Alberto Giambone

Posted on

UITabBar not showing

Maybe your ios app have a Login ViewController just before a TabBarController, and you want the TabBarController appear after login Success :)
Doing this by:

let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "Home") as! HomeViewController
                nextVC.modalPresentationStyle = .fullScreen
                self.present(nextVC, animated: true, completion: nil)
Enter fullscreen mode Exit fullscreen mode

The result is TabBarItem not appearing in the HomeViewController :(

Image description

You can avoid this by creating a UITabBarController files and assign this at UITabBarController, and point at this instead of HomeViewController

let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "tabBar") as! TabBar
                nextVC.modalPresentationStyle = .fullScreen
                self.present(nextVC, animated: true, completion: nil)
Enter fullscreen mode Exit fullscreen mode

Image description

And the result is the TabBarIter are showed correctly 🥳🥳🥳

Top comments (0)