Animating resizing and moving UIView at the same time

Posted by chouchou on Stack Overflow See other posts from Stack Overflow or by chouchou
Published on 2010-03-17T06:42:24Z Indexed on 2010/03/17 7:11 UTC
Read the original article Hit count: 341

I'd like to "Stretch" a UIView to the right side, meaning increase it's frame.size.width by foo pixels and at the same time decreasing it's frame.origin.x by foo pixels, using [UIView beginAnimations] syntax. However, if I do that, when the animation begins the view immediately resizes, and then starts the animation for the origin.

CGRect currFrame = someView.frame;
currFrame.size.width += 100;
currFrame.origin.x -= 100;

[UIView beginAnimations:@"Anim1" context:nil];
someView.frame = currFrame;
[UIView setAnimationDuration:0.7];
[UIView commitAnimations];

I've also tried breaking the animation down to 2 parts but then I can't keep the right position in place.

Any help is much appreciated!

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about core-animation