title: ios code for CATransition works only the first time?
body: <p>I use this code to make the transition from one view to another in ios sdk but it is working only the first time, when i return back to the previous view it does not work although the code is triggered...</p>
  
  <p>UIView *currentView = self.viewController1.view;</p>
  
  <pre><code>// get the the underlying UIWindow, or the view containing the current view view
  UIView *theWindow = [currentView superview];
  
  // remove the current view and replace with myView1
  [currentView setHidden:TRUE];//hide previous view diladi to tabviewcontroller
  self.viewController1=[[MyFriendProfile alloc] initWithNibName:@"MyFriendProfile" bundle:nil];
  [theWindow addSubview:self.viewController1.view];
  [currentView setHidden:FALSE]; 
  // set up an animation for the transition between the views
  CATransition *animation = [CATransition animation];
  [animation setDuration:0.5];
  [animation setType:kCATransitionPush];
  [animation setSubtype:kCATransitionFromRight];
  [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
  
  [[theWindow layer] addAnimation:animation forKey:@"SwitchToView2"];
  </code></pre>
  
  <p>Any help Appreciated!</p>