0

I know this question was asked before, but non of the answer is working for me, so I am asking it again if some new ideas come up.

I have UISplitView controller in universal app, and in master view controller I need TabBarController, like this

enter image description here

My problem is that with this configuration, when I tap on cell, DetailViewController did show, but it slide from the bottom and not from the right side, and it does not have back button. This let me believe that is not on the right navigation stack.

Some things that I try but is not working (and I will not accept as answer!)

  1. Put NavigationController before TabBarController :

enter image description here

This solution presents two major problem. First is a very ugly black shadow on the right side of the navigation bar when transitioning. Second is that after second click on cell, back button stop working.

  1. Adding code

    func splitViewController(splitViewController: UISplitViewController, showDetailViewController vc: UIViewController, sender: AnyObject?) -> Bool {
    if splitViewController.collapsed {
           let tabBarController = splitViewController.viewControllers.first as! UITabBarController
           let selectedNavigationViewController = tabBarController.selectedViewController as! UINavigationController
    
           // Push view controller
           var viewControllerToPush = vc
           if let navController = vc as? UINavigationController {
               viewControllerToPush = navController.topViewController
           }
    
      selectedNavigationViewController.pushViewController(viewControllerToPush, animated: true)
    
           return true
       }
    
       return false
    }
    

This does nothing for me, but it give me an error if I rotate my device multiple times :

<Error>: CGImageCreate: invalid image size: 0 x 0.

I don't believe that this could not be done. The master and detail view could be any View controllers class so why tabbarviewcontroller doesn't work?

Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
  • Why don't you simply take the UITabBarController first? UITabBarController->SplitViewControllers. That's what users normally expect since its recommended in Apples Human Interface Guidelines and what other apps do. –  Apr 26 '17 at 09:44
  • The visual effect is not the same. And Facebook Messenger have the same behaviour as I want. – Marko Zadravec Apr 26 '17 at 11:16

0 Answers0