1

I have three UIViewControllers. First one is MainViewController. MainViewController has TabView and, under TabView, childView (UIView). Depending on picked tab, childViewController is opened (on childView). childViewController has TableView. I want to enable when you pick cell on that TableView, to push new UIViewController (let's call it EventDetailViewController) and to be visible on full screen using UINavigationController (without TabView from MainViewController). How to achieve that? I use SnapKit, so everything is programatically.

  • That can be confusing navigation... you might be better off ***presenting*** the "detail" view controller using `.modalPresentationStyle` of `.fullScreen` or `.overFullScreen` – DonMag Jun 07 '23 at 20:06

2 Answers2

0

You can set the hidesBottomBarWhenPushed property of your detail view controller to true. Here is a short blogpost on this topic.

Raluca Toadere
  • 201
  • 1
  • 3
-1

Instantiate UITabBarController with UINavigationController. Then, push it to the navigationController that Tabbar belongs to. This way, you can push the tabbar and there is no need for a present.

If you are using a storyboard, you can embed the UITabBarController in a UINavigationController for the tabbar.

Example:

final class TabBarController: UITabBarController {

override func viewDidLoad() {
    super.viewDidLoad()

    let firstViewController = UIViewController()
    let secondViewController = UIViewController()
    
    firstViewController.title = "First"
    secondViewController.title = "Second"
    
    let navigationController = UINavigationController(rootViewController: self)
    
    self.viewControllers = [firstViewController, secondViewController]
    
    UIApplication.shared.windows.first?.rootViewController = navigationController
    UIApplication.shared.windows.first?.makeKeyAndVisible()
    
    // Push to Navigation Controller
    let thirdViewController = UIViewController()
    thirdViewController.title = "Third"
    navigationController.pushViewController(thirdViewController, animated: true)
}
}
  • The tab controller should not be in a nav controller. Each tab should have its own nav controller as needed. – HangarRash Jun 21 '23 at 15:40
  • @HangarRash I agree too but my solution is possible. Each flow should have its own navigationController as well as its tabbar. – Furkan Sandal Jun 21 '23 at 15:46