I tried to search this site and all over the internet, but I haven't found a way that will let me switch between multiple view controllers while sharing data between them. I tried to use the following code (the first method calls another method then switches view):
-(IBAction) choosePhoto:(id)sender {
[self startMediaBrowserFromViewController: self
                            usingDelegate: self];
if(firstViewController.view.superview == nil)
{
    [secondViewController viewWillAppear:YES];
    [firstViewController viewWillDisappear:YES];
    [firstViewController.view removeFromSuperview];
    [self.view insertSubview:self.secondViewController.view atIndex:0];
    [firstViewController viewDidDisappear:YES];
    [secondViewController viewDidAppear:YES];
}
//3. now add animation
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//blue view will appear by flipping from right
if (secondViewController.view.superview == nil)
{
    [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight 
                           forView:self.view cache:YES];
    [secondViewController viewWillAppear:YES];
    [firstViewController viewWillDisappear:YES];
    [firstViewController.view removeFromSuperview];
    [self.view insertSubview:self.secondViewController.view atIndex:0];
    [firstViewController viewDidDisappear:YES];
    [secondViewController viewDidAppear:YES];
}
[UIView commitAnimations];
    }
- (IBAction)switchViews:(id)sender {
if(self.secondViewController.view.superview == nil)
{
    [firstViewController.view removeFromSuperview];
    [self.view insertSubview:secondViewController.view atIndex:0];
}
    }
This does a nice animation but doesn't switch the view controllers.
Help please?
EDIT: Also putting another view inside the first view controller and how to switch the views will be helpful.