0

I'm trying to create a storyboard scene for tvOS where a UIViewController has an embedded UITableViewController. I'm unable to make the connection, though, and I'm not sure if I'm doing something wrong.

At present, I have a UIViewController scene, and a separate UITableViewController scene. The UIViewController scene has a UITableView within it. When I try to make an "embed" connection from the UIViewController to the UITableViewController, I can't select anything else in the Document Outline. I tried adding another UITableViewController to the main scene's dock, and it will only let me drop it onto the canvas, not as a part of the main scene.

I haven't done this with iOS yet, so I'm not sure if what I'm trying is supposed to work, and it's a bug I need to report, or if I'm taking the wrong approach.

Dov
  • 15,530
  • 13
  • 76
  • 177
  • In particularly you need to use container views *in code* for this problem. It does work perfectly in tvOS. there are many long explanations of container views in such situations, including https://stackoverflow.com/a/23403979/294884 – Fattie Nov 30 '22 at 15:49
  • Does this answer your question? [How to add a subview that has its own UIViewController in Objective-C?](https://stackoverflow.com/questions/23399061/how-to-add-a-subview-that-has-its-own-uiviewcontroller-in-objective-c) – Fattie Nov 30 '22 at 15:49

1 Answers1

1

Embed segues can't be created from a "normal" UIView, you need to set it from a ContainerView class that you need to drop into your UIViewController.

raulriera
  • 714
  • 10
  • 28
  • I'm sorry, I don't think you're understanding correctly. Right now, I'm not trying to trigger a segue to another scene. I'm trying to embed my table view and controller into another view. – Dov Dec 04 '15 at 14:37
  • oops, you are correct. are you sure you are creating the embed segue (this is a segue as well) from the ContainerView and not the UIViewController? – raulriera Dec 04 '15 at 15:15
  • Argh. I got it now. I didn't realize that "Container View" was an actual type of view you could drop in (since it's at the _bottom_ of the list). Now I get it. If you want to update your answer to reflect that (replacing my UITableView in the UITableViewController scene with a "Container View"), I'll accept it. – Dov Dec 04 '15 at 16:49