Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think one way to do this is with a container view with a container view controller inside it. That container controller would have 2 child controllers which would be your CoreDateTableViewController and NRGridViewController. I've implemented something like this, and I can show you some code if you're interested.</p> <p>After Edit: In a test app, I started with a single view template and a storyboard. I added two buttons to the top of the view and a container view to the bottom half of the view (this first controller is of class ViewController). I then dragged out a new view controller, and control dragged from the container view to the new controller and chose the "embed segue" (this will resize the view to be the same size as the container view). The class of this controller was changed to my subclass, ContainerController. I then created 2 more controllers for the 2 views that will be managed by the container controller (the views need to have their size set to "freeform" in IB so you can set the size to be the same as the container view). Here is the code in ContainerController:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.cont1 = [[FirstController alloc]initWithNibName:@"FirstView" bundle:nil]; self.cont2 = [[SecondController alloc]initWithNibName:@"SecondController" bundle:nil]; [self addChildViewController:self.cont1]; self.currentController = self.cont1; [self.view addSubview:self.cont1.view]; } -(void)switchToFirst { if (self.currentController != self.cont1) { [self addChildViewController:self.cont1]; [self moveToNewController:self.cont1]; } } -(void)switchToSecond { if (self.currentController != self.cont2) { [self addChildViewController:self.cont2]; [self moveToNewController:self.cont2]; } } -(void)moveToNewController:(id) newController { [self.currentController willMoveToParentViewController:nil]; [self transitionFromViewController:self.currentController toViewController:newController duration:.6 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{} completion:^(BOOL finished) { [self.currentController removeFromParentViewController]; [newController didMoveToParentViewController:self]; self.currentController = newController; }]; } </code></pre> <p>The only code I have in ViewController are the IBActions for the 2 buttons that switch the views. Those methods just call methods in the container controller:</p> <pre><code>-(IBAction)chooseFirstController:(id)sender { [self.childViewControllers.lastObject switchToFirst]; } -(IBAction)chooseSecondController:(id)sender { [self.childViewControllers.lastObject switchToSecond]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload