0

I am building an iPad app that loads a UITableView with some information. On the didSelectRowAtIndexPath function I would like to load a UISplitViewController. I created a segue from the cell to the split view but then I get the following error:

Split View Controllers cannot be pushed to a Navigation Controller .

I am still new to iOS development, so can someone help me out a bit.

AnthoPak
  • 4,191
  • 3
  • 23
  • 41

2 Answers2

0

Indeed, the segue to use is not a Push segue but a Replace one.

Using UISplitViewController requires some configuration, so I can't give you the code here. I had to make a UISplitViewController recently and I've succeeded thanks to this great tutorial. Tell me if you have any question/problem.

AnthoPak
  • 4,191
  • 3
  • 23
  • 41
  • Thanks, i will definitely take a look at it. By the way, is it against Apple's HIG to have a split view controller that isn't the root view controller? I read some where that it was. Can you confirm? –  Jun 22 '16 at 20:26
  • I've just learned that from you ! I googled and I've seen posts going on your way. But I really don't know if it's up to date... Nevertheless, [this SO question](http://stackoverflow.com/a/19983002/4894980) might help you making a `UISplitViewController` without breaking Apple guidelines. – AnthoPak Jun 22 '16 at 21:23
0

Apple states that the split view controller is typically the root view controller here. They then go ahead and suggest that using it in any other way is not recommended. I would follow that advise. In my own experience UISplitViewController can be a pain if you try to use it in any other way where it is not the root view controller. You could therefore write up your own, or make use of the other third party solutions available. I personally wrote up one myself and it is better than anything else I have trialled, with much less code. MGSplitViewController is one of the few I trialled, was terrible, and the code underneath handles a lot of things the wrong way, like sending rotation messages to its child view controllers through notifications. Im calling them childViewControllers but they were actually not added as such. You learn a few things too if you do it yourself.

pnizzle
  • 6,243
  • 4
  • 52
  • 81
  • I used a UISplitViewController as a modal and it works great, didn't encounter any problem. But I don't know about the Apple submission... – AnthoPak Jun 23 '16 at 07:50