Embed Segue - iOS 5

泄露秘密 提交于 2019-11-30 10:08:27

The problem is that Embed segue is iOS 6+. It fails because you are trying to instantiate EmbedSegue internal class which does not exist in iOS 5. The obvious solution is not to use EmbedSegue if you need iOS 5 support :)

Here comes another question - what to use instead? I'm having the very same problem at the moment; I will share if I find any graceful architecture solution for that.


looks like the solution is quite obvious for any "old-school" iOS developer. Here's how you do that.

  1. In your "parent" view controller instantiate "child" view controller in viewDidLoad: or whenever suitable
  2. [self addChildViewController:childVC];
  3. [self.view addSubview:childVC.view];
  4. childVC.view.frame = ....;

Now you should see view you did for your child VC in nib or storyboard will display in your parent's view where you specify it.

Hopefully this will help any seeking soul to decouple their logic :)

Cheers, Dan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!