Extending a view to the left side, animated

Posted by Heinrich on Stack Overflow See other posts from Stack Overflow or by Heinrich
Published on 2010-06-15T15:11:06Z Indexed on 2010/06/17 10:43 UTC
Read the original article Hit count: 184

Hi,

I have a view that I want to extend on the left side using an animation. All borders but the left one should remain the same, so the x position and the width of the view are changing.

I use this code:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:5.0];
self.frame = CGRectMake(self.frame.origin.x-100,
                        self.frame.origin.y,
                        self.frame.size.width+100,
                        self.frame.size.height);
[UIView commitAnimations];

If I run this code, the width of the view is set to the new value immediately and then the view is moved to the new x point, but why? How can I change this behaviour?

Thanks for your ideas!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk