views:

142

answers:

0

This should be simple and I am half way there but still having problems. I have 2 xib files which a button in each switches views - all working fine. I want to add some animation. In the first view controller I have the following code which is also working fine...

SecondTimerViewController *TimerView = [[SecondTimerViewController alloc]  
           initWithInt:hStart 
           number:mStart 
           number:sStart
           number:hTarget
           number:mTarget
           number:sTarget];
 [UIView beginAnimations:nil context:NULL];
 [UIView setAnimationDuration:1.5]; 
 [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];

 [self.view addSubview:TimerView.view]; 
 [UIView commitAnimations];

In my second view controller the way I switch back at the moment is using this code...

-(IBAction)backBtn:(id)sender{
[self.view removeFromSuperview];

}

I put the [self.view removeFromSuperview] into my animation block I expected this to work but it doesn't. Please can someone tell me what I am doing wrong and try and explain why. I am pretty new to this and clearly am missing some understanding here :-s Thanks