Dear experts! :)

Task: to authorize the user and go to the TabBar page.

When navigating using StoryBoard а (Action Segue) панель TabBar a а (Action Segue) панель TabBar is visible. During the program transition, the TabBar is not displayed.

Program transition:

 let goToMain = self.storyboard?.instantiateViewController(withIdentifier: "MainActivity") as! MainActivity let navBarOnModal: UINavigationController = UINavigationController(rootViewController: goToMain) self.present(navBarOnModal, animated: true, completion: nil) 

Storyboard: enter image description here

Question: How to make TabBar visible during a program transition? (UITabBarController (). TabBar.isHidden = false does not help)

  • And why do not you try to put the Navigation Controller in front of the Main Activity Tab Controller and go to it already? - Pavel Lazarev

2 answers 2

Judging by your given piece of code, you go to the UINavigationController , and not to the UITabBarController .

  1. Set Storyboard ID in your storyboard at Tab Bar Controller

    Storyboard ID

  2. The transition can be done as follows:

     let storyboardName = "Main" let storyboard = UIStoryboard(name: storyboardName, bundle: nil) let identifier = "MainTabBarController" let tabBarController = storyboard.instantiateViewController(withIdentifier: identifier) present(tabBarController, animated: true, completion: nil) 
  • Thank. Works. - Lobs 8:49 pm

Usually, when working with a storyboard from program code, you do not need to manually call the instantiateViewController method to create a ViewController. It is enough to call the performSegue method and pass the segue identifier specified in the storyboard to it.

Maybe I do not correctly understand the reason why you use instantiateViewController , but if you call the following code from the correct ViewController, everything should work.

 performSegue(withIdentifier: "Идентификаторв Segue, заданный в storyboard", sender: self) 
  • Unfortunately, the program crashes, although I tried different "names" of identifiers. Although your method, as a way, really liked. You can write more about the identifier in Segue, given in the storyboard - Lobs
  • @Lobs In Storyboard, ViewControllers are connected by arrows. Roughly speaking, the arrow is Segue. For each Segue, you can specify a unique identifier. To do this, click on Segue, and on the right side of Xcode you will be able to edit the parameters. You need to set a parameter called Identifier in the Storyboard Segue section. Use the given name in the code as the Segue identifier. - Denis
  • Thank. Your solution also works. Thank you very much! - Lobs