Using Multiple Storyboards in iOS

Daddycat Tan Yin See picture Daddycat Tan Yin See · Nov 28, 2011 · Viewed 66.8k times · Source

My objective is to create a tabbed application, then the view for each of the tabs are constructed in separate storyboards.

Storyboard screenshot

My mainstoryboard is a tab view.

Then I create a secondary storyboard (storyboard#2) with 2 View Controllers. The first view controller (also ticked as initial) have a button, and segue (modal) to 2nd view. First view controller

I managed to load the view by subclassing and overriding loadView from storyboard#2. loadView override

Here's the simulator output.

Simulator

When click on the "click me" button, I get a EXC_BAD_ACCESS. The segue does not work, seems like the second storyboard is not being loaded completely.

Has anyone tried to do this before and get it working? There's a youtube video from SkillMaster.net but he does not demonstrate if a segue is working under the secondary storyboard. the video is here: http://youtu.be/D4_twoYvB4M

Thanks for any input and help!

Screenshots:

Answer

Rhubarb picture Rhubarb · Oct 1, 2012

These are the best articles I've seen on multiple storyboards.

Not only does this guy tell you how to create a new storyboard in code, he

  • recommends multiple storyboards in practice (more modular code)
  • discusses when to use xibs vs storyboards (xibs hold views, storboards are based on controllers)
  • provides a class for linking storyboards with segues on github

Note that this last point is important because the key downside of multiple storyboards is that you can't usually link them with segues, but robs library allows that with a bit of fudging

Also see the discussed here