Je rencontre ce problème lorsque j'ouvre un nouveau View Controller par programmation.La barre d'onglets n'apparaît pas dans View Controller à l'intérieur du contrôleur de navigation
let controller = self.storyboard?.instantiateViewController(withIdentifier: "overViewScreen") as! OverviewViewController
controller.user = self.userObject
let navigationController = UINavigationController(rootViewController: controller)
self.present(navigationController, animated: true, completion: nil)
La structure de mon projet: storyboard
Sur mon storyboard la barre d'onglets est affichée sur le contrôleur de vue (avec la table à droite), mais quand je lance l'application, il ressemble à ceci : enter image description here
J'espère que vous les gars peuvent me aider! Merci.
Voulez-vous dire quelque chose comme ça? let tabBarController = self.storyboard? .instantiateViewController (withIdentifier: "TabBarController") self.present (tabBarController !, animé: true, complétion: nil) –
Ou quelque chose comme: let tabVC = UIStoryboard (name: "NameOfYourStoryboard", bundle: Bundle.main) .instantiateInitialViewController() as! UITabBarController laisser navVc = tabVC.viewControllers.first comme! UINavigationController let vc = navVc.viewControllers.first comme! LoginViewController vc.incorrectAuthorization = SettingsAuthorizationMethod.fingerprint vc.user = self.userObject présent (NavController, animé: true, achèvement: néant) –
Alors maintenant, je dois: laisser tabBarController = self.storyboard .instantiateInitialViewController() comme! UITabBarController laissez navVc = tabBarController.childViewControllers.first as! UINavigationController laissez vc = navVc.childViewControllers.first as! AperçuViewController vc.user = self.userObject self.present (navVc, animé: vrai, achèvement: aucun). Erreur: Impossible de convertir LoginViewController en UITabBarController –