title: iPhone SDK: switching views navigationcontroller
body: <p>my first question here so be gentle :)</p>
  
  <p>I am trying to use a navigationController to switch views.
  I got the following down:
  I got a MainView controller which switches to different view controllers using this code:</p>
  
  <pre><code>UIButton *buttonPressed = (UIButton *)sender;
  
      switch (buttonPressed.tag) {
      case 1:
          viewController = catalogView;
          break;
      case 2: 
          viewController = locatorView;
          break;
      case 3:
          viewController = galleryView;
          break;
  }
  [[self navigationController] pushViewController:viewController animated:YES];
  </code></pre>
  
  <p>Now I try, to switch to another view in one of these views.</p>
  
  <p>I figured: I have to import the main view and simply create a method here to switch views.</p>
  
  <p>e.g.</p>
  
  <pre><code>- (IBAction)goToProductView {
      //UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Test" message:@"hier" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok", nil] autorelease];
      //[alert show];
      viewController = galleryView;
      [[self navigationController] pushViewController:viewController animated:YES];
  }
  </code></pre>
  
  <p>and I call this function from within a viewcontroller like so:</p>
  
  <pre><code>myViewController *mainView = [[myViewController alloc] init];
  [[self navigationController] popViewControllerAnimated:NO];
  [mainView goToProductView];
  </code></pre>
  
  <p>The function of mainView gets called here (the alert shows if I unquote it) but the view does not change.</p>
  
  <p>Anyone here can tell me why, or has a better solution?</p>
  
  <p>Thanks in advance</p>
  
  <p>(ps. if I missed any information please feel free to ask and I will supply them asap)</p>