I have been researching and researching and trying everything i could find on the internet but nothing seems to work for me. Can anyone tell me how to have a splitview controller as a child view of a tabbar controller? the closest ive gotten to getting it right is when i click on the tab it shows the detail view instead of the master. if some one could give me a clean cut way to achieve this it would be greatly appreciated.
-
Where's the code you have so far? – Shades Jul 31 '16 at 17:59
-
I Posted this also and didnt really get help but it is what i have. http://stackoverflow.com/questions/38277908/uisplitviewcontroller-within-uitabbarcontroller-swift – user3462448 Jul 31 '16 at 21:02
2 Answers
Answers here might help apple recommends UISplitViewController should always be the rootviewcontroller
Here is the note from apple
You cannot push a split view controller onto a navigation stack. Although it is possible to install a split view controller as a child in some other container view controllers, doing is not recommended in most cases. Split view controllers are normally installed at the root of your app’s window.
I recommend you to create your customn splitViewController
-
ive created my own custom splitviewcontroller class and put the code in this example in it and it didnt work. http://stackoverflow.com/questions/38277908/uisplitviewcontroller-within-uitabbarcontroller-swift what should i put in the custom class? – user3462448 Aug 02 '16 at 22:13
-
I didnt mean creating a customn `UISplitViewController` I meant create yout own splitview using viewcontrollers like https://github.com/mattgemmell/MGSplitViewController – Koushik Aug 03 '16 at 05:29
-
In the example you mentioned `UITabBarController` is the rootViewController but u need to have your `UISplitViewController` as the rootViewController – Koushik Aug 03 '16 at 05:31
-
ill check out the first comment, but to your second comment. is there a way to have the splitviewcontroller as rootview and my app still be able to navigate with a tabbarcontroller? – user3462448 Aug 03 '16 at 15:47
Start with just a splitViewController
and try to get that one working, see for instance this excellent tutorial. Once your happy with that, try to embed it inside a tabBarController
, either in code or in a storyboard. Follow the tutorial carefully, you will need to make some adjustments when you add the tabBarController
. Good luck!

- 5,383
- 7
- 50
- 89