views:

52

answers:

2

hi, i have used viewcontroller with multiple view. when i go back to previous, there is no animation i have tried by below lines of code ,

-(IBAction)goback
{
[UIView beginAnimations:nil context:NULL];
 [UIView setAnimationDuration:1];
 [UIView setAnimationTransition: UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
 [self.view removeFromSuperview]; 
 [UIView commitAnimations];
}
+1  A: 

You can't animate a method call. You can only animate properties of the view such as frame, size, alpha etc. removeFromSuperview isn't a property, it is a method that simply finds the superview and removes the originating view from the array of subviews.

You need to run the animation and then send removeFromSuperview when the animation completes.

TechZen
A: 

use below code

[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view.superview cache:YES]; [self.view removeFromSuperview];
[UIView commitAnimations];

this is true answer for multiview application
@jaydp: As it is your question, why not vote it as the answer if it is correct?
Ardman