Is it possible to use container view in prototype UITableViewCell

I have a group of interacting cell prototype controls. I found that I want to reuse the same collaboration group outside of the table, in a different view controller.

So, I created a new one UIViewController

in my storyboard, moved all the controls, and moved the interaction behavior from my subclass UITableViewCell

to the new one. Now I just need to put the container view in the prototype cell in the storyboard and connect the inline segment. Easy.

What I don't know how to do is where the new subplot controller (my new subclass) will be created and how can I refer to it from the cell subclass code? I need to pass some information from cell properties to inline view controller. I can create an output for a container view in my cell, but for a view, not an inline view controller.

+3


source to share


1 answer


When you embed a view controller in another view controller, the container's viewController method is called prepareForSegue:

- here you can save a reference to segue.destinationViewController

.

And that is prepareForSegue:

not the problem - the method UITableViewCell

, so there will be no way to capture the controller of the child view.



Of course, as you discovered, you get a compilation error anyway!

+7


source







All Articles