Animating removeFromSuperview

Posted by user230949 on Stack Overflow See other posts from Stack Overflow or by user230949
Published on 2010-01-05T05:18:32Z Indexed on 2012/06/18 21:17 UTC
Read the original article Hit count: 149

I'd like to animate the transition from a subview back to the super view.

I display the subview using:

[UIView beginAnimations:@"curlup" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[self.view addSubview:self.mysubview.view];
[UIView commitAnimations];

The above works fine. It's going back to the super view that I don't get any animation:

[UIView beginAnimations:@"curldown" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[self.view removeFromSuperview];
[UIView commitAnimations];

Is there something different I should be doing to get the subview to animate when removed?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch