Custom container controller + storyboard?

I want to implement my own container view controller. Pls imagine this is my ipad

enter image description here

Regular split view controller view, but I want to expand it: the width of the "a" view should be changeable when I press "B" - the "C" view goes to the visible area

enter image description here

For example, in my storyboard, I have 3 container views: AViewController (for A view), BViewController, CViewController, and one combo view controller (initial view controller). In a Combo View Controller, I will inject segues from the container view and initialize the relationship between the container views through the following code:

@property ... *aViewController,*bViewController,*cViewController;
    - (void)prepareForSegue:(UIStoryboardSegue *)segue
    sender:(id)sender
    {
    if ([segue.identifier isEqualToString:@"EmbedAViewController"])
    {
    self.aViewController =
    segue.destinationViewController;
    }
    if ([segue.identifier isEqualToString:@"EmbedBViewController"])
    {
    self.bViewController=segue.destinationViewController
    }

   -(void)viewDidLoad
   {
     [super viewDidLoad];
     self.aViewController.bViewController=self.bViewController;
   }

      

Question1 : Is it the right way to implement my assignment with a storyboard? Q2 : What are the limitations of container views? Is this a visual replacement for the addChildViewController API? If not, where should I implement the parent-parent relationship? I have to use in my combined view controller in the prepareForSegue method

 [self addChildViewController:aViewController]; 
    [self.view addSubview:aViewController.view];

      

Question3 : How do I put the container view outside of the visible area at the start?

If I was mistaken somewhere or had a big misunderstanding of basic concepts, do not beat me. I have done a lot of google-foo, I would really appreciate any help. Thank you very much in advance!

Edit:
I want to establish a relationship between them. Content "B" for viewing depends on "A" and content for "C" viewing depends on "B".

+3


source to share


1 answer


I think you have some misconceptions. If you want to implement container view controllers in your storyboard, you don't need to do anything in code. Start with one controller that you call on the combo view controller and drag and drop 3 container views. Initially, you may want them to be sized so that they are full height and that they all fit side by side in the main view. You can then resize and position them using the Size inspector so that the C view starts at the right edge of the Combine Controllers view, so it will be off from the start. You will automatically get three view controllers connected to their respective container views using an inline segment.All three of these controllers will be created at the same time as the combo controller. You will need a weekend in a combo controller for each of its container views so you can modify them as needed in your code.



+5


source







All Articles