title: How can I push a new View Controller from a button within a subView (another View Controller) in Storyboard
body: <p>Wow, I gave a big thought on the question!</p>
  
  <p>So I have a view Controller called "ContentView" within another view Controller (Main VC). The Main VC has a Navigation Controller which was created using Storyboards. And the contentView loads 3 different view controllers (vc1, vc2 and vc3) depending on the options that a Segmented Control has. So the question now is:</p>
  
  <p>How can I load a new View Controller from the button within one of the subviews (vc2) that will appear once the user selects the option from the segmented control?</p>
  
  <ol>
  <li><p>Although I have the visible view controller (vc2) in my storyboard, obviously I cannot connect an action to the button to the vc2' file's owner since the Nav Controller is on the Main VC.</p></li>
  <li><p>I tried to access it with the following code:</p>
  
  <pre><code>AppDelegate *del = (AppDelegate *)[UIApplication sharedApplication].delegate;
  UINavigationController *navigationController =     (UINavigationController*)del.window.rootViewController;
  DetalleMisMarcas *detalleMarcas = [[DetalleMisMarcas alloc] initWithNibName:@"DetalleMarcas" bundle:nil];
  
  [navigationController pushViewController:detalleMarcas animated:YES];
  </code></pre></li>
  </ol>
  
  <p>But it does not work.</p>
  
  <p>I have tried to find a solution from this forum, but I had no luck. Most consider the existence of a Main Window Xcode 4.2 does not have.</p>
  
  <p>Finally, the way I load the 3 subviews, is here:</p>
  
  <pre><code>    -(IBAction)segmentCtrlChanged:(id)sender {
  UISegmentedControl *seg = sender;
  if (seg.selectedSegmentIndex == 0)
  {
  
      MMViewController *mm= [self.storyboard instantiateViewControllerWithIdentifier:@"MMView"];
      mm.view.frame = CGRectMake(0, 0, 320, 240);
      [contentView addSubview:mm.view];
  
  }
  
  else if (seg.selectedSegmentIndex == 1) {
      MPViewController *mp = [self.storyboard instantiateViewControllerWithIdentifier:@"MPView"];
      mp.view.frame = CGRectMake(0, 0, 320, 240);
      [contentView addSubview:mp.view];
  
      }
  }
  
  -(IBAction)mainSubView:(id)sender
  {
  MMViewController *mm = [[MMViewController alloc] initWithNibName:@"MTView" bundle:nil];
  [contentView addSubview:theMTView];
  mm.view.frame = CGRectMake(0, 0, 320, 240);
  
  }
  </code></pre>
  
  <p>Any ideas?</p>