title: How to execute method after removefromsuperview
body: <p>I have a UIViewController (call it SubUIVC) that was loaded via my main UIViewController (call it MainUIVC) using my showNewView method and when I am done with the SubUIVC, I return to MainUIVC using my goBack method.</p>
  
  <p>What I'd like to do is execute some code in MainUIVC once the goBack method is completed and my MainUIVC.view has been loaded.  </p>
  
  <p>Can anyone help me with doing this?  Below are the two methods I made reference to above.</p>
  
  <pre><code>-(void) showNewView:(UIViewController*)showView{    
  UIView *currentView = self.view;
  
      // get the the underlying UIWindow, or the view containing the current view
      UIView *theWindow = [currentView superview];    
      UIView *newView = showView.view; 
  
      // remove the current view and replace with newView
      [theWindow addSubview:newView];
  
      // set up an animation for the transition between the views
      CATransition *animation = [CATransition animation];
      [animation setDuration:WIPE_ANIMATION_DURATION];
      [animation setType:kCATransitionPush];
      [animation setSubtype:kCATransitionFromRight];
      [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
  
      [[theWindow layer] addAnimation:animation forKey:@"SwitchToNewView"];
  }
  
  -(IBAction)goBack:(id)sender{       
      UIView *currentView = self.view;
  
      // get the the underlying UIWindow, or the view containing the current view
      UIView *theWindow = [currentView superview];
  
      // remove the current view and replace with superview
      [currentView removeFromSuperview];
  
      // set up an animation for the transition between the views
      CATransition *animation = [CATransition animation];
      [animation setDuration:WIPE_ANIMATION_DURATION];
      [animation setType:kCATransitionPush];
      [animation setSubtype:kCATransitionFromLeft];
      [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
  
      [[theWindow layer] addAnimation:animation forKey:@"SwitchToNewView"];
  }
  </code></pre>