Paste Segue - iOS 5

I dragged a Container View onto one of my View controllers. This happens with an Embed Segue. Execution produces the following:

'Could not instantiate class named UIStoryboardEmbedSegueTemplate' 

So, from a few other questions related to stackoverflow, it seems that this is not implemented in iOS 5. However, the questions did not suggest a fix. Xcode will not allow me to use any other type of segue.

If the answer is to create a custom container, I will go with that. Over the past couple of days I have seen a lot of code for this. Just wondering if there was a way to do this using the provided Container View object.

+6
source share
1 answer

The problem is that Embed segue is iOS 6+. It fails because you are trying to create an instance of the inner class EmbedSegue, which is not in iOS 5. The obvious solution is not to use EmbedSegue if you need iOS 5 support :)

Here's another question - what to use instead? I have the same problem at the moment; I will share if I find a graceful architectural solution for this.


It seems like the solution is completely obvious to any "old school" iOS developer. This is how you do it.

  • In your "parent" view controller, instantiate the "child" view controller in viewDidLoad: or when appropriate
  • [self addChildViewController: childVC];
  • [self.view addSubview: childVC.view];
  • childVC.view.frame = ....;

Now you should see what you have done for your child VC in nib, or the storyboard will appear in your parent view, where you specify it.

I hope this helps any soul who wants to separate their logic :)

Cheers, dan

+9
source

All Articles