0

I want to use a third-party library which implements a nice tabbar controller. But it does all the work programmatically, basically all it does is create two uiviewcontrollers and add them to a tabbarcontroller, and then instantiate an uinavigationcontroller with the tabbarcontroller. In the last step, it assigns the uinavigationcontroller to the rootviewcontroller of the window like the following:

self.window?.rootViewController = getNavigationController()

But I want to use this navigationcontroller in a place other than the rootviewcontroller of the window, say like I want to push from another view and goes to this navigationcontroller. How can I achieve that?

photosynthesis
  • 2,632
  • 7
  • 29
  • 45

1 Answers1

-1

You can present it modally over your current navigation controller from your current viewcontroller

let vc = myNavigationControllerWithTabBarControllerInside() //change this to your navigation controller
self.navigationController.presentViewController(vc, animated: true, completion: nil)

Please verify, for your self.navigationController to not be nil. otherwise, use

self.presentViewController(vc, animated: true, completion: nil)
gunjot singh
  • 2,578
  • 20
  • 28
  • For this to work, your current viewController should be a child of UINavigationController, i.e to be pushed inside navigation Controller . Please verify, for your self.navigationController to not be nil. otherwise, use self.presentViewController(vc, animated: true, completion: nil) – gunjot singh Feb 26 '16 at 06:03