views:

42

answers:

1

Why doesn't this code do anything?

[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationCurveEaseIn forView:self.view cache:YES];

[self.view removeFromSuperview];

[UIView commitAnimations];

Also, where can I see all the list of possible arguments for beginAnimations:?

+4  A: 

You should set the animation transition on the view containing the change, e.g..

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
                       forView:self.view.superview cache:YES];

Also, the transition should be a constant of type UIViewAnimationTransition.

The +beginAnimations:context: method can take any string as its 1st argument, and any pointer as its 2nd argument.

KennyTM
What is the purpose of giving an arbitrary string to beginAnimations?
awakeFromNib
@awake: Give an identifier to the animation, in case you have a `+setAnimationWillStartSelector:` etc.
KennyTM
All I had to do was add superview and that fixed it.
awakeFromNib