1

I want to navigate from the login screen to UITabBarController. I use this Line to navigate --> navigationController?.pushViewController(tabBarVC, animated: true)

When navigate show me two NavigationBar.

I want to solve this problem.

preview

fatihyildizhan
  • 8,614
  • 7
  • 64
  • 88
  • check https://stackoverflow.com/questions/41144523/swap-rootviewcontroller-with-animation. Presently you are pushing a new view controller onto the navigation stack of the Login VC, you really need to replace the root VC of your app with the `UITabBarController` – CSmith Apr 28 '21 at 14:13
  • my root VC is Login Screen I want when click login button go to tab bar but the problem is navigation bar doublicated – Mohamed Essam Apr 28 '21 at 14:29
  • I understand your question, the nav bar is duplicated because you're pushing a new view controller that also contains navigation controllers. You should try the suggestion of switching root view controller...or better yet have the tab controller as your root view controller, then present the Login view controller modally on top as needed. Then you'd only need to dismiss the Login VC after successful login. – CSmith Apr 28 '21 at 17:30

1 Answers1

0

Make a subclass of UITabBarController for your tabBarVC, Add these lines:

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    navigationController?.setNavigationBarHidden(true, animated: true)
}