Applying animation while resizing or moving the view

Animation can be applied while its frame, bounds, center, transform, alpha… is being changed.  The key is set start and end values between beginAnimations and commitAnimations, so called animation block.

 
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration: 1.0];
 
// set original position
[view setFrame:CGRectMake(0, 0, 100, 100)];
 
// move and grow
[view setFrame:CGRectMake(100, 100, 200, 200)];
 
[UIView commitAnimations];

,

No comments yet.

Leave a Reply