Reputation: 9359
I need to make a simultanous animation on UIView. I want to change size and position at the same time. I try this code :
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationBeginsFromCurrentState:NO];
[openingElement setFrame:elementFrame];
[UIView commitAnimations];
This code work but UIView animate in two step (move and after resize) and I want to do it together. Is it possible to make one animation with multiple changes?
Upvotes: 0
Views: 679
Reputation: 171
it is possible to make multiple changes in one animation. On a UIView you can animate changes for alpha, bounds, frame, center, transform and backgroundColor at the same time.
If you have problems with animation on the frame property, try to animate center and bounds.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationBeginsFromCurrentState:NO];
[openingElement setBounds:newBounds];
[openingElement setCenter:newCenter];
[UIView commitAnimations];
Upvotes: 1